I generated a heatmap graphic with the following code:
A = c(rep(100,22),rep(0,15),rep(10,12), rep(50,14))
B = c(rep(0,22),rep(8,15),rep(13,12), rep(82,14))
C = c(rep(0,22),rep(8,15),rep(13,6),rep(75,6), rep(82,14))
D = c(rep(0,22),rep(8,15),rep(13,12), rep(82,14))
E = c(rep(100,22),rep(0,15),rep(10,12), rep(50,14))
F = c(rep(0,22),rep(8,15),rep(13,6),rep(75,6), rep(82,14))
G = c(rep(0,22),rep(8,15),rep(13,12), rep(82,14))
H = c(rep(80,22),rep(72,15),rep(5,12), rep(2,14))
df= data.frame(A,B,C,D,E,F,G, H)
correct_columnnames <- c("34T","56G", "45T","78T", "12F","25G","90F","78T")
colnames(df) <- correct_columnnames
split = c(rep(1,22),rep(2,15),rep(3,12), rep(4,14))
row_labels = c(rep("A",22),rep("B",15),rep("C",12), rep("D",14))
rowlabels= data.frame(row_labels)
row_labels = rowAnnotation(df = rowlabels,
col = list(row_labels = c("A"="#e48f1c","B"="#570c32","C"="#e5c616","C"="#d33b44", "D" = "#38ECF9")),
annotation_legend_param = list(direction = "horizontal",
nrow = 1,
title = "Groups",
title_position = "topcenter",
legend_gp = gpar(fontsize = 14),
labels_gp = gpar(fontsize = 14)),
gp = gpar(col = "grey") )
h1 = Heatmap(df,
clustering_method_columns = "average",
rect_gp = gpar(col = "grey", lwd = 1),
right_annotation = row_labels,
cluster_rows = FALSE,
heatmap_legend_param = list(legend_direction = "horizontal",
title = "M porcentage",
legend_width = unit(11, "cm"),
title_position = "topcenter",
at = c(0,10,20,30,40,50,60,70,80,90,100),
labels = c(0,10,20,30,40,50,60,70,80,90,100),
fontsize = 16),
width = ncol(filtered_data)*unit(5, "mm"),
height = nrow(filtered_data)*unit(5, "mm"),
column_split = 7,
column_title = NULL,
row_split = split,
row_title = NULL)
png("test.png",width=20,height=20, res = 300, "in")
draw(h1, heatmap_legend_side = "bottom", annotation_legend_side = "bottom" )
dev.off()
The script gives me a figure like this:
My question is:
Is it possible to write some letters in superscript in ComplexHeatmap in the row names and change row_labels to "row labels"?
so the graphic should be like this: