Question: R: Cluster Similarity Percentages With Inverted Y-Axis (Example Included)
2
gravatar for Fucitol
8.0 years ago by
Fucitol120
Netherlands
Fucitol120 wrote:

Hi All,

Although not really a bioinformatics question (only it's purpose in phylogenetics), I was wondering how I could perform a Bray Curtis similarity clustering in R in which I show the similarity percentages on an inverted Y-axis and all tree nodes ending at 100% as shown in the following picture (which I'm trying to replicate):

At the moment I create my plot in the following way (using S17 Bray Curtis dissimilarity measure, which just scales regular Bray Curtis to 0-100%):

library(vegan)
mat = 'some matrix'
d = (1 - vegdist(mat, method="bray")) * 100 
h = hclust(d)
plot(h)

Inverting the Y-axis (with ylim=c(100,80)) doesn't work. How can I create a dendogram as shown above from a distance matrix? Thanks for any help / advice!

As adviced, I've also posted this question at Cross Validated, see here

R clustering distance • 7.3k views
ADD COMMENTlink modified 6.9 years ago by Joseph Hughes2.7k • written 8.0 years ago by Fucitol120

I don't have an answer for you, but you should also try the statistics wizards at http://crossvalidated.com (another Q&A site)

ADD REPLYlink written 8.0 years ago by David Quigley11k
5
gravatar for Joseph Hughes
6.9 years ago by
Joseph Hughes2.7k
Scotland, UK
Joseph Hughes2.7k wrote:

13 months late but might still be useful:

library(vegan)
mat = mtcars
d = (1 - vegdist(mat, method="bray")) * 100
h = hclust(d)
plot(h, main = "Clustering cars using Bray Curtis method", sub = "", xlab="", axes = FALSE, hang = -1)
lines(x = c(0,0), y = c(0,100), type = "n") # force extension of y axis
axis(side = 2, at = seq(0,100,10), labels = seq(100,0,-10))

It looks like this:

enter image description here

ADD COMMENTlink modified 6.7 years ago • written 6.9 years ago by Joseph Hughes2.7k
2

Just notice that

h = hclust(d)
ADD REPLYlink written 6.7 years ago by Marcus20

Thanks, I've corrected it.

ADD REPLYlink written 6.7 years ago by Joseph Hughes2.7k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1293 users visited in the last hour