Hi I have a distance matrix which is computed by user defined method. I would like to plot the dendrogram. I would like to use different color and want the leaves laying down bottom. The script like this. I am not familiar with R. I followed the example shown in http://stat.ethz.ch/R-manual/R-devel/library/stats/html/dendrogram.html dist.obj <- as.dist(matrix.distance) hc.obj <- hclust(dist.obj,method="ave") dend1 <- as.dendrogram(hc.obj) plot(hc.obj, xlab='',ylab='',sub='', nodePar=list(pch = c(1,NA), cex=0.8, lab.cex = 0.8)). But I got warning and the plot does not look like what I wanted. Warning messages: In plot.hclust(hc.obj, xlab = "", ylab = "", sub = "", nodePar = list(pch = c(1, : "nodePar" is not a graphical parameter It also can not recognize edgePardLeafedge.root Does someone know what's wrong? Br, Luffy
farscape2012 <farscape2012 at live.com> writes:> Hi > > I have a distance matrix which is computed by user defined method. I > would like to plot the dendrogram. I would like to use different color > and want the leaves laying down bottom. > The script like this. I am not familiar with R. I followed the example > shown in > http://stat.ethz.ch/R-manual/R-devel/library/stats/html/dendrogram.html > > dist.obj <- as.dist(matrix.distance) > hc.obj <- hclust(dist.obj,method="ave") > dend1 <- as.dendrogram(hc.obj) > plot(hc.obj, xlab='',ylab='',sub='', nodePar=list(pch = c(1,NA), > cex=0.8, lab.cex = 0.8)). > > But I got warning and the plot does not look like what I wanted. > > Warning messages: > In plot.hclust(hc.obj, xlab = "", ylab = "", sub = "", nodePar > list(pch = c(1, : > "nodePar" is not a graphical parameter > > It also can not recognize > > edgePar> dLeaf> edge.root > > Does someone know what's wrong?Yep. You did not follow the example. You used the wrong object in the call to plot() and it dispatched to plot.hclust rather than plot.dendrogram. Try plot( dend1, ... ) HTH, Chuck> > Br, > Luffy >-- Charles C. Berry Dept of Family/Preventive Medicine cberry at ucsd edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
hc.obj is not a dendrogram. plot(dend1, xlab='',ylab='',sub='', nodePar=list(pch = c(1,NA), cex=0.8, lab.cex = 0.8)) See ?plot.hclust and ?plot.dendrogram. They are not using the same arguments. Regards, Eloi On 12-04-30 06:36 AM, farscape2012 wrote:> Hi > > I have a distance matrix which is computed by user defined method. I > would like to plot the dendrogram. I would like to use different color > and want the leaves laying down bottom. > The script like this. I am not familiar with R. I followed the example > shown in > http://stat.ethz.ch/R-manual/R-devel/library/stats/html/dendrogram.html > > dist.obj <- as.dist(matrix.distance) > hc.obj <- hclust(dist.obj,method="ave") > dend1 <- as.dendrogram(hc.obj) > plot(hc.obj, xlab='',ylab='',sub='', nodePar=list(pch = c(1,NA), > cex=0.8, lab.cex = 0.8)). > > But I got warning and the plot does not look like what I wanted. > > Warning messages: > In plot.hclust(hc.obj, xlab = "", ylab = "", sub = "", nodePar = > list(pch = c(1, : > "nodePar" is not a graphical parameter > > It also can not recognize > > edgePar> dLeaf> edge.root > > Does someone know what's wrong? > > Br, > Luffy > > ______________________________________________ > R-help at 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. >-- Eloi Mercier Bioinformatics PhD Student, UBC Paul Pavlidis Lab 2185 East Mall University of British Columbia Vancouver BC V6T1Z4
Seemingly Similar Threads
- Formatted Data File Question for Clustering -Quickie Project
- how to colour labels (each label with a colour) in a dendrogram?
- how to add an edgetext to a dendrogram?
- dendrogram branches with different lty
- Coloring leaves, twigs and labels in plot.dendrogram()