在ComplexHeatmap中,如何改变anno_barplot()标题的角度?

问题描述 投票:0回答:1

我使用 R 包,

complexheatmap
来绘制热图。 这是我的代码:

aa <- rowAnnotation("log10(FDR)" = anno_barplot(fdr), 
                    "log2(Fold Change)" = anno_barplot(fc, gp = gpar(fill = fc_color(fc))),
                    width = unit(3, 'cm'),
                    gap = unit(10, "points"))
Heatmap(matrix = mtx, 
             border = T, 
             column_order = ordered_sample, 
             heatmap_legend_param = list(title = "", 
             legend_height = unit(4, "cm")), column_names_rot = -90, 
             row_names_gp = gpar(fontsize = 8), 
             column_names_gp = gpar(fontsize = 8), 
             clustering_method_rows = "ward.D2", 
             name = "Scale(exp)", 
             cluster_column_slices = T, row_split = rr_,
             cluster_rows = T, 
             cluster_columns = F, 
             clustering_method_columns = "ward.D2",
             col = htmp_color, right_annotation = aa
        )

我的问题是如何将

log10(FDR)
转90度? 这样两个Barpl图的标题就不会重叠

r complexheatmap
1个回答
0
投票

如果能提供一些样本数据就更好了。使用另一个示例,

annotation_name_rot = 90
似乎可以解决问题(旋转
foo2
bar2
右下角):

library(ComplexHeatmap)

set.seed(123)
mat = matrix(rnorm(100), 10)
rownames(mat) = paste0("R", 1:10)
colnames(mat) = paste0("C", 1:10)
column_ha = HeatmapAnnotation(foo1 = runif(10), bar1 = anno_barplot(runif(10)))
row_ha = rowAnnotation(foo2 = runif(10), bar2 = anno_barplot(runif(10)), annotation_name_rot = 90)
Heatmap(mat, name = "mat", top_annotation = column_ha, right_annotation = row_ha)

创建于 2024-04-25,使用 reprex v2.1.0

© www.soinside.com 2019 - 2024. All rights reserved.