-1

I'd like to constrain the y-axis on dendrogram plot in R. Now, I have the y-axis ranging from 1 to 3000. Is the correct function to achieve this ylim? How should I do it?

plot(fit, main = 'Dendrogram', xlab = '', 
ylim =c(1,500), sub ='', axes = TRUE, ylab = 'Distance')
Alex A.
  • 5,466
  • 4
  • 26
  • 56
Roger
  • 11
  • 5
  • You're using `plot()` to construct the dendrogram, I assume from the result of `hclust()` or something similar? Did including the `ylim=` argument not solve the issue? – Alex A. Apr 24 '15 at 14:43
  • Do you mean changing the heights of the dendrogram itself, or to trim the plot in the Y axis? – Tal Galili Apr 24 '15 at 20:45
  • p.s: please take a tour http://stackoverflow.com/tour – Tal Galili Apr 24 '15 at 20:54

1 Answers1

0

A ggplot solution:

library(ggplot2)
library(ggdendro)
ggdendrogram(fit) + ylim(1,500)
Magnilex
  • 11,584
  • 9
  • 62
  • 84
scoa
  • 19,359
  • 5
  • 65
  • 80