Mercurial > hg > plosone_underreview
view scripts_R/radial_dendro.R @ 87:ae885c2e5cc4 branch-tests
trying to merge
author | Maria Panteli |
---|---|
date | Tue, 26 Sep 2017 21:40:10 +0100 |
parents | cc028157502a |
children |
line wrap: on
line source
library(ape) library(cluster) df = read.csv("data/cluster_freq.csv") data = df[,2:dim(df)[2]] rownames(data) <- df$labels distMahal = as.dist(apply(data, 1, function(i) mahalanobis(data, i, cov = cov(data),tol=1e-18))) hc=hclust(distMahal, method="average") mypal = c("#000000", "#9B0000", "#9B0000", "#9B0000", "#9B0000") clus5 = cutree(hc, 5) pdf('data/hierarchical_cluster_R.pdf') par(mar=c(1,1,1,1)) plot(as.phylo(hc),type="fan",tip.color=mypal[clus5], cex=.5, label.offset=.5) dev.off()