gpt4 book ai didi

r - 将堆叠条形图作为注释时只有一个条

转载 作者:行者123 更新时间:2023-12-02 04:34:44 25 4
gpt4 key购买 nike

我正在尝试制作堆叠条形图作为热图上的列注释。我使用 ComplexHeatmap

这是条形图的输入 (foo):

      V1    V2    V3
1 28.50 67.30 0.00
2 0.00 63.90 25.40
3 16.30 67.80 15.90
4 24.10 75.30 0.00
5 0.00 70.90 20.60
6 18.90 62.50 13.90
7 19.80 68.70 11.50
8 22.60 64.90 10.10
9 28.10 66.80 0.00
10 16.60 74.30 0.08
11 0.14 79.90 0.06
12 23.70 0.71 0.00
13 26.70 66.60 0.00
14 16.80 58.20 20.60
15 13.30 82.20 0.00
16 0.32 61.70 6.30
17 21.50 62.20 0.14

为了简单起见,我删除了其他注释和热图,只制作了“麻烦”的注释图。这是我的代码:

library(ComplexHeatmap)
ha = HeatmapAnnotation(barplot = anno_barplot(foo), annotation_height = unit(30,"mm"))
hm = Heatmap(zero_row_mat, top_annotation = ha)
hm

这是生成的条形图 enter image description here

阅读 ComplexHeatmap 引用手册时,我希望得到一个堆叠条形图,因为我的输入是一个矩阵(超过 1 列),但我只得到一个酒吧。我不知道我做错了什么。有什么想法吗?

最佳答案

你是对的,当我运行时:

DF <- data.frame( A = rep(c(0,5), 5), B = 2:11, C = 3:12 )
hb = HeatmapAnnotation(barplot = anno_barplot(DF), annotation_height = unit(30,"mm"))
hm = Heatmap(matrix(1:10,nrow=1), top_annotation = hb)
hm

我得到了一个堆叠条形图。你得到了什么?

关于r - 将堆叠条形图作为注释时只有一个条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44596922/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com