[R] plot.hclust with lots of objects
Martin Maechler
maechler at stat.math.ethz.ch
Sat Nov 8 15:58:21 CET 2008
>>>>> "TP" == Thomas Petzoldt <thpe at simecol.de>
>>>>> on Sat, 08 Nov 2008 11:11:30 +0100 writes:
TP> Hi Paul, one possibility: write the tree to a wide pdf
TP> file and then zoom and scroll using Adobe Acrobat or
TP> another PDF reader. Here is a tree with 1000 objects:
TP> x <- matrix(rnorm(3000), nrow=1000)
TP> hc <- hclust(dist(x))
TP> pdf("tree.pdf", width=150)
TP> plot(hc)
TP> dev.off()
Indeed.
Also, if you first transform your hclust() result into a "dendrogram"
i.e.
dhc <- as.dendrogram(hc)
...
plot(dhc, ......)
you can make use of the (hidden!) plot.dendrogram() method
which is much more customizable (but typically slower)
than plot.hclust().
Martin Maechler, ETH Zurich
TP> paul murima wrote:
>> Dear all,
>>
>> The default plotting method for hclust trees looks just fine for few
>> objects like in the example dataset. But when it comes to many
>> features (eg some 1000 and more - I'm trying to visualize clustered
>> microarray data) it renders a tree, that one cannot inspect, because
>> of overlapping text and lines. My question is, is there a way or a
>> plotting parameter for plotting a tree which is wide enough to have
>> all leaves separated and readable labels even for that many objects?
>> This would produce a very big image, so I think scrolling is
>> essential.
>>
>> I believe the answer is simple, but I'm unable to figure it out.
>>
>> Thanks in advance
>>
>> --
>> BEST
>>
>> Paul Murima
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
TP> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
TP> --
TP> Thomas Petzoldt
TP> Technische Universitaet Dresden
TP> Institut fuer Hydrobiologie thomas.petzoldt at tu-dresden.de
TP> 01062 Dresden http://tu-dresden.de/hydrobiologie/
TP> GERMANY
TP> ______________________________________________
TP> R-help at r-project.org mailing list
TP> https://stat.ethz.ch/mailman/listinfo/r-help
TP> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
TP> and provide commented, minimal, self-contained, reproducible code.
TP> x <- matrix(rnorm(3000), nrow=1000) hc <-
TP> hclust(dist(x)) pdf("tree.pdf", width=150) plot(hc)
TP> dev.off()
TP> Thomas P.
TP> paul murima wrote:
>> Dear all,
>>
>> The default plotting method for hclust trees looks just
>> fine for few objects like in the example dataset. But
>> when it comes to many features (eg some 1000 and more -
>> I'm trying to visualize clustered microarray data) it
>> renders a tree, that one cannot inspect, because of
>> overlapping text and lines. My question is, is there a
>> way or a plotting parameter for plotting a tree which is
>> wide enough to have all leaves separated and readable
>> labels even for that many objects? This would produce a
>> very big image, so I think scrolling is essential.
>>
>> I believe the answer is simple, but I'm unable to figure
>> it out.
>>
>> Thanks in advance
>>
>> --
>> BEST
>>
>> Paul Murima
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
>> read the posting guide
TP> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained,
>> reproducible code.
TP> -- Thomas Petzoldt Technische Universitaet Dresden
TP> Institut fuer Hydrobiologie
TP> thomas.petzoldt at tu-dresden.de 01062 Dresden
TP> http://tu-dresden.de/hydrobiologie/ GERMANY
TP> ______________________________________________
TP> R-help at r-project.org mailing list
TP> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
TP> read the posting guide
TP> http://www.R-project.org/posting-guide.html and provide
TP> commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list