ColSideColors
1
0
Entering edit mode
Sabah khalid ▴ 10
@sabah-khalid-2500
Last seen 9.6 years ago
Dear all, I have been using R for a short time now and I am having a little difficulty with the following. Whilst I am able to generate one row of ColSideColors above my heatmap, I would like to generate 2 ColSideColors each representing different information. So far I have: #the column one from my headers file is used as ColSideColors mycols2 <- as.character(as.numeric(headers$one)); #I would also like to present this column (two) aswell, but do not know how.. mycols3<-as.character(as.numeric(headers$two)); heatmap(mymatrix,ColSideColors = mycols2,col= greenred(256)); How can I incorporate mycols3 into the heatmap function as well? I am thinking it must be a syntax issue which I am not too familiar with yet. Thank you to anyone who can help me
• 2.7k views
ADD COMMENT
0
Entering edit mode
@wolfgang-huber-3550
Last seen 18 days ago
EMBL European Molecular Biology Laborat…
Dear Sabah, have a look at this: http://tolstoy.newcastle.edu.au/R/e2/help/07/09/25712.html there is a code example, I repeat it here for your convenience: library("lattice") library("latticeExtra") hc1 = hclust(dist(USArrests, method = "canberra")) hc1 = as.dendrogram(hc1) ord.hc1 = order.dendrogram(hc1) hc2 = reorder(hc1, state.region[ord.hc1]) ord.hc2 = order.dendrogram(hc2) region.colors = trellis.par.get("superpose.polygon")$col levelplot(t(scale(USArrests))[, ord.hc2], scales = list(x = list(rot = 90)), colorkey = FALSE, legend = list(right = list(fun = dendrogramGrob, args = list(x = hc2, ord = ord.hc2, side = "right", size = 10, size.add= 0.5, add = list( rect = list(col = "transparent", fill = region.colors[state.region]), rect = list(col = "transparent", fill = region.colors[rev(state.region)])), type = "rectangle")))) Generally, the heatmap function from the base package is quite inflexible, and I doubt that it would be easy or worthwhile to make it do what you propose. The suggestion that Deepayan is making above will require a certain amount of investment of your time in understanding how the lattice graphics package works, but it is worth it! Best wishes Wolfgang ------------------------------------------------------------------ Wolfgang Huber EBI/EMBL Cambridge UK http://www.ebi.ac.uk/huber Sabah khalid ha scritto: > Dear all, > > I have been using R for a short time now and I am having a little difficulty > with the following. Whilst I am able to generate one row of ColSideColors > above my heatmap, I would like to generate 2 ColSideColors each representing > different information. > > So far I have: > > #the column one from my headers file is used as ColSideColors > mycols2 <- as.character(as.numeric(headers$one)); > #I would also like to present this column (two) aswell, but do not know > how.. > mycols3<-as.character(as.numeric(headers$two)); > > heatmap(mymatrix,ColSideColors = mycols2,col= greenred(256)); > > How can I incorporate mycols3 into the heatmap function as well? I am > thinking it must be a syntax issue which I am not too familiar with yet. > > Thank you to anyone who can help me > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENT

Login before adding your answer.

Traffic: 791 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6