R ComplexHeatMap从grid.text重定位图例并调整其大小

时间:2018-09-10 14:10:29

标签: r

我有生成此图像的代码,如何更改grid.text,以使范围图例显示在底部,并且我可以更改它们的大小和位置,例如,在其他吗?

ht1<-Heatmap(merged2, 
        show_row_dend = FALSE,
        show_column_dend = FALSE,
        show_row_names = FALSE,
                 row_names_gp = gpar(fontsize = 8),
         column_names_gp = gpar(fontsize = 8),

            name = "# Var4 long name,# Var5 long name,# Var6 long name,# Var7 long name", cell_fun = function(j, i, x, y, width, height, fill) 
        {
          grid.text(sprintf("%.0f", merged2[i, j]), x, y, gp = gpar(fontsize = 8))
        }
        ,
        col = colorRamp2(c(-max_merged, 0, max_merged), c(rgb(200/255, 202/255, 201/255), rgb(240/255, 240/255, 240/255), rgb(116/255, 122/255, 119/255))))

ht2<-Heatmap(mergedvc2, 
        show_row_dend = FALSE,
        show_column_dend = FALSE,
        #show_row_names = FALSE,
         # list(axis.text.x = element_text(size = 10,face = "bold")),
        row_names_side = "left",
         row_names_gp = gpar(fontsize = 8),
         column_names_gp = gpar(fontsize = 8),


        #heatmap_legend_side = "bottom",

            name = "# Var2", cell_fun = function(j, i, x, y, width, height, fill) 
        {
          grid.text(sprintf("%.0f", mergedvc2[i, j]), x, y, gp = gpar(fontsize = 8))
        },
        col = colorRamp2(c(0, max_mergedvc), c(rgb(72/255, 130/255, 58/255),rgb(203/255, 229/255, 197/255)))
        )


ht_list<-ht2+ht4

draw(ht_list, gap = unit(0, "cm"))

0 个答案:

没有答案