Thank you for mentioning the
dendextend<http://cran.r-project.org/web/packages/dendextend/>package
Gregory.

As I mention in the package, the dendextend package implements a similar
function as in the dendroextra. The big difference between the two is that
the dendextend package has an implementation of the "cutree" function for
dendrograms (making it possible to not have to go through the hclust object
in order to perform it). This is helpful when using non-standard
dendrograms that can not be turned into an hclust object (via
as.hclust.dendrogram).
Also, the dendextend package includes many other functions for dendrogram
manipulation which might be helpful.

Here is a quick example that can give you a sense of the possibilities:


install.packages("dendextend")
require(dendextend)

# pdf("dendextend_example.pdf")
dend <- as.dendrogram(hclust(dist(USArrests), "ave"))
d1=color_branches(dend, k=5, col = c(3,1,1,4,1))
plot(d1) # selective coloring of branches :)
d2=color_branches(d1,k=5)
plot(d2) # getting rainbow_hcl colors for each cluster (the default)
d3=color_branches(d1,5,groupLabels=TRUE) # adding numbers to the branches
plot(d3)
d4=color_labels(d3, k=5, col = c(3,1,1,4,1)) # color labels by cluster
plot(d4)
d5=color_labels(d4, col = c("red", "orange")) # color labels from left to
right
plot(d5)
# dev.off()

Here is the output:
https://www.dropbox.com/s/vii83jd9xnbmuv7/dendextend_example.pdf

Also, there is a (rough draft) of a vignettes for the package here:
https://github.com/talgalili/dendextend/blob/master/vignettes/dendextend-tutorial.pdf?raw=true

Feedback is welcome.

Best,
Tal









----------------Contact
Details:-------------------------------------------------------
Contact me: tal.gal...@gmail.com |
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------



On Sat, Apr 26, 2014 at 10:36 AM, Gregory Jefferis <jeffe...@gmail.com>wrote:

>
> On 26 Apr 2014, at 06:41, Gregory Jefferis <jeffe...@gmail.com> wrote:
>
> > # plot dendrogram coloured by cluster:
> > ##
> > library(dendroextras)
> > cluc=colour_clusters(clu, k=3, groupLabels =TRUE)
> > plot(cluc)
>
> There was a typo in an argument name for colour_clusters in my earlier
> response (thanks to Dennis Murphy for pointing this out). Correction in
> above.
>
> Fancier versions are also possible:
>
> plot(colour_clusters(clu, k=3, groupLabels = as.roman))
>
> Best,
>
> Greg.
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to