Reputation: 341
I want to display vector 'values' as a heatmap label. Does someone knows how to do it? Here is my table1
# drug-1 drug-2 drug-3 drug-4
# assay-1 7.045337 0.000000 0.000000 0
# assay-2 4.693248 4.430464 0.000000 0
# assay-3 4.505905 0.000000 NA 0
# assay-4 4.777868 4.765742 NA 0
# assay-5 5.549705 4.950920 4.546701 0
my_palette <- colorRampPalette(c("red", "yellow", "green"))(n = 299)
col_breaks = c(seq(-1,2,length=100), seq(2.1,4,length=100), seq(4.1,10,length=100))
heatmap.2(table1, main = " heading",notecol="black",density.info="none", trace="none", margins =c(16,20),col=my_palette,breaks=col_breaks, dendrogram="row",Colv="NA")
this gives me
I want to have third lable
values <- c(3.1,4.2,5.0,6.4)
so my image should look like
Upvotes: 0
Views: 310
Reputation: 438
Try adding in heatmap.2 the following argument
add.expr=text(x=seq_along(col_breaks), y=5, labels=values, pos=4)
I cannot reproduce your example so positions x and y might need adjustment.
Upvotes: 1