You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在ComplexHeatmap中关闭图例刻度连接线(保留原宽度)

解决ComplexHeatmap图例黑色连接线问题

你可以直接在Legend()函数中添加link = FALSE参数来关闭这些黑色连接线,不需要调整图例宽度。修改后的代码如下:

Minn=-15
Maxx=1
col_fun = colorRamp2(c(Minn,-3.3,Maxx), 
                     c("blue", "#EEEEEE", "red"))

lgd_sig2 = Legend(col_fun=col_fun,
                  title = "Abundance (log2)",
                  legend_height = unit(1.5, "cm"),
                  title_position = "topcenter",
                  title_gp = gpar(fontsize = 5),
                  labels_gp = gpar(fontsize = 5),
                  direction = "horizontal",
                  at = c(Minn,-3.3,Maxx),
                  labels_rot = 0,
                  grid_height = unit(0.25, "cm"),
                  legend_width = unit(1.22, "cm"),
                  link = FALSE) # 新增参数关闭连接线

这个参数会直接取消标签与颜色条之间的关联连接线,完美保留你当前设置的图例宽度。

内容的提问来源于stack exchange,提问作者user2300940

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 08:40:30