raivokolde / pheatmap

Pretty heatmaps
225 stars 83 forks source link

Any option for front color of rows/column labels? #74

Open bbalog87 opened 4 years ago

bbalog87 commented 4 years ago

Hi all,

Thanks for this great package. # I am wondering whether there is an option/parameter to customize the front color for specific row/column labels. That's, for example, assigning the same colors used for group (column) annotation to the corresponding genes (rows).

jinghuazhao commented 3 years ago

I bet we could track the code to when the labels are generated but is more painstaking -- in fact I had the some query yesterday, quoted below -- .

Dear Raivo,

I came across your great package pheatmap from work and managed one with very simple commands as below-- we would like to alternate colours of the column labels underneath but could not furnish it.

Is it possible?

Thanks so much,

Jing Hua

keenhl commented 2 years ago

This should work

default color

colors[1:21] <- c("black")

rows with different colors

for (i in c(1,5) ){ colors[i] <- "red" }

hm$gtable$grobs[[4]]$gp <- gpar(col=colors)

where hm is the pheatmap object

change 4 to 3 to access the column data