Description Usage Arguments Details Value Note Author(s) See Also Examples
This function takes a hclust object and a vector of colors as its input and plots the hclust object with colored labels.
1 |
hclust |
a hclust object |
lab |
labels to use |
lab.col |
colors to use for each label |
hang |
see "hclust" |
... |
see "hclust" |
This function is normally only called by "virtualArray.ExpressionSet".
A modified hclust object is returned.
The function was written by Eva Chan and incorporated into this package by Andreas Heider
Original author: Eva Chan
Modified by: Andreas Heider (2011)
virtualArray-package, virtualArray.ExpressionSet, virtualArrayCompile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # we use the USArrests dataset
new.arrests <- USArrests
# now we need to specify a function to create colors
color_me <- function(x){
if(x >= 100){"red"}
else{"blue"}
}
# lets build the colors in relation to the "Assaults" statistic
new.arrests[,5] <- sapply(new.arrests[,2],color_me)
# we need a distence matrix to build our tree
dist1 <- dist(new.arrests[,1:4],method="euclidian")
# and we need a conventional hclust object
hc_nocolor <- hclust(dist1,method="average")
# now we can hook up to that object and change the label colors
# note that this call will automatically plot the tree
virtualArrayHclust(hc_nocolor,lab=rownames(new.arrests),lab.col=new.arrests[,5])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.