嗨,我正在使用 ComplexHeatmap 包并遵循他们的小插图,但是由于某种原因,我似乎无法强迫图例变为水平。所以例如这里是一个例子,
set.seed(123)
library(ComplexHeatmap)
mat = matrix(rnorm(80, 2), 8, 10)
mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
rownames(mat) = paste0("R", 1:12)
colnames(mat) = paste0("C", 1:10)
ha_column = HeatmapAnnotation(df = data.frame(type1 = c(rep("a", 5), rep("b", 5))),
col = list(type1 = c("a" = "red", "b" = "blue")),
annotation_legend_param = list(type1 = list(
title_gp = gpar(fontsize = 16),
legend_direction = "horizontal", labels_gp = gpar(fontsize = 8)))
)
ht1 = Heatmap(mat, name = "ht1", column_title = "Heatmap 1", top_annotation = ha_column)
draw(ht1, heatmap_legend_side = "right")