0

I would like to create a heatmap from the following data (made simpler):

TFs <- c("IRF2", "IRF3", "IRF5", "IRF7", "STAT1")
columnnames <- c("IFN-alpha", "IFN-beta", "IFN-gamma", "Healthy", "Cancer", "Virus")
heatmap_matrix <- matrix(sample(1:30, 30), nrow=length(TFs))
colnames(heatmap_matrix) <- columnnames 
rownames(heatmap_matrix) <- TFs

Where IFN-alpha, -beta and -gamma belong to one condition (interferon treatment) and Healthy, Cancer and Virus belongs to another condition (cell condition). I would like to use something like annotation strips or fill colour to specify the cell condition.

I used heatmap(heatmap_matrix) but this just plots the columns as individual variables and I'm not sure where to go now.

Many thanks!

Levia
  • 1
  • 1
  • See https://stackoverflow.com/questions/3789549/display-a-matrix-including-the-values-as-a-heatmap. Does this help? – nrennie Jun 12 '23 at 14:34
  • @nrennie thanks for the comment but turns out I just needed to use ```annotation_col``` from pheatmap to annotate my data – Levia Jun 12 '23 at 16:03

0 Answers0