Hi,
I have a dataframe "df" like following:
Sample ID G1 G2 G3 G4 G5 G6
S1 3 1 1 2 1
S2 2 1 2 1 1
S3 3 2 1 1 1
S4 2 2 1 1 1 1
S5 3 2 1 1 1
S6 2 1 1 2 1
S7 3 3 1 2 1 1
S8 4 2 1 1 1
S9 3 1 2 2 1
S10 2 3 2 2 1 1
S11 2 1 2 4 1
S12 3 2 1 2 1
S13 2 2 1 1 1
I'm using "complexheatmap" R package to generate a heatmap.
plot <- data.frame(df[,-1], row.names=df[,1])
library(ComplexHeatmap)
library(circlize)
pdf("plot.pdf", width=5, height=6.5)
Heatmap(plot, show_row_names = TRUE, show_column_names = TRUE, cluster_rows = FALSE,
cluster_columns = FALSE,show_column_dend = FALSE,show_row_dend = FALSE)
dev.off
This gave me a heatmap like - https://imgur.com/a/HMVOH
My Question:
How can I assign different colors for each column. And how to give different legend for each column. I want to give different colors and legend for (3,2,4) in G1 column and different colors and legend for (1,2) in G3 column and different colors and legend for (1,2) in G4 column. And also different Legend headings for different columns.
How to do this?
Thank you
Hi Bioinfo,
Deleting a question after someone spend time helping you is unnecessary and rude. I have restored this thread.
Wouter