I am doing some bibliometric analysis of interdisciplinarity using cluster analysis of co-authorship. I'd like to be able to specify the colour of individual authors in the labels to show a prior grouping by discipline (red for sociology authors, blue for economics authors, ..., that sort of thing). Is there any way of doing this sort of thing? I'm hoping for something like: h <- hclust(authors.dist) h$labels <- colorlabels(c("red", "blue",..., "green")) plot(h)
patricia garcía gonzález
2009-Feb-05 14:51 UTC
[R] change individual label colours in a cluster plot?
Hi, If you have a variable, that defines what you want to differentiate (sociology, economics etc.) then you can add color depending on the value of that variable. You will have to convert it to numeric if it is not. An example would be plot( iris[ , 1 ], iris[ , 2], col = iris[ , 3 ] ) Regards Patricia> To: r-help@stat.math.ethz.ch > From: j.ottaway@lse.ac.uk > Date: Thu, 5 Feb 2009 13:44:21 +0000 > Subject: [R] change individual label colours in a cluster plot? > > I am doing some bibliometric analysis of interdisciplinarity using > cluster analysis of co-authorship. > > I'd like to be able to specify the colour of individual authors in the > labels to show a prior grouping by discipline (red for sociology > authors, blue for economics authors, ..., that sort of thing). > > Is there any way of doing this sort of thing? I'm hoping for something like: > > h <- hclust(authors.dist) > > h$labels <- colorlabels(c("red", "blue",..., "green")) > > plot(h) > > ______________________________________________ > R-help@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._________________________________________________________________ [[alternative HTML version deleted]]