# Let's use iris as we all love the iris dataset ## Perform hierarchical clustering on the iris data irisDen <- as.dendrogram(hclust(dist(`rownames<-`(iris[1:4], iris[,5]), method='euclidean', ), method='ward.D2')) ## Add the species information to the leafs irisDen <- dendrapply(irisDen, function(d) { if(is.leaf(d)) attr(d, 'nodePar') <- list(species=iris[as.integer(attr(d, 'label')),5]) d }) # Plotting this looks very much like ggplot2 except for the new geoms ggraph(graph = irisDen, layout = 'dendrogram', repel = TRUE, circular = TRUE, ratio = 2) + geom_edge_elbow() + geom_node_text(aes(x = x*1.05, y=y*1.05, filter=leaf, angle = atan(y/x)*360/(2*pi), hjust='outward'), size=3) + geom_node_point(aes(filter=leaf, color=species)) + coord_fixed()
I'll be happy to take any feedback and hope that it will prove useful to a lot of you...
best
Thomas
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.