Mercurial > hg > plosone_underreview
diff scripts_R/PlotOutliersCountry.R @ 91:d3e05cd49feb branch-tests
trying to plot wrt PLOSONE guidelines
author | Maria Panteli <m.x.panteli@gmail.com> |
---|---|
date | Mon, 02 Oct 2017 15:32:51 +0100 |
parents | 103f7411c3ad |
children |
line wrap: on
line diff
--- a/scripts_R/PlotOutliersCountry.R Mon Oct 02 12:37:55 2017 +0100 +++ b/scripts_R/PlotOutliersCountry.R Mon Oct 02 15:32:51 2017 +0100 @@ -12,12 +12,18 @@ df = read.csv("../data/results/cluster_freq.csv") data = df[,2:dim(df)[2]] +levels(df$labels)[which(levels(df$labels)=="Democratic Republic of the Congo")]="DR Congo" +df$labels[which(df$labels=="Democratic Republic of the Congo")] = "DR Congo" 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, 4) -pdf('../data/results/hierarchical_cluster.pdf') +pdf('../data/results/hierarchical_cluster.pdf', pointsize=12) par(mar=c(1,1,1,1)) plot(as.phylo(hc),type="fan",tip.color=mypal[clus5], cex=.5, label.offset=.5) dev.off() +postscript('../data/results/hierarchical_cluster.eps', pointsize=12) +par(mar=c(1,1,1,1)) +plot(as.phylo(hc),type="fan",tip.color=mypal[clus5], cex=.5, label.offset=.5) +dev.off()