Skip to content
Prev 70581 / 398525 Next

Forcing ticks in plot for hclust object outside the limits

Ale? ?iberna wrote:
Not easy with the plot method for a hclust object, because 0.05 and 0.25 
are getting clipped, because they are out od the "usr" coordinated of 
the plot.

Of course you could hack plot.hclust (in Namespace stats) by modifying 
.../R/library/src/stats/R/hclust.R as follows (in order to provide a 
proper ylim argument):

diff hclust.R-orig hclust.R

91c91,92
<               sub = NULL, xlab = NULL, ylab = "Height", ...)
---
 >               sub = NULL, xlab = NULL, ylab = "Height",
 >               ylim = NULL, ...)
116c117,120
<     .Internal(dend.window(n, merge, height, hang, labels, ...))
---
 >     height2 <- height
 >     if(!is.null(ylim))
 >         height2 <- c(range(ylim), rep(ylim[1], length(height) - 2))
 >     .Internal(dend.window(n, merge, height2, hang, labels, ...))


Note that this quick hack is a *dirty* solution.

Uwe Ligges