r - R 热图中的颜色标签(文本)

标签 r colors heatmap labels

我正在尝试在 R 中制作一个热图,其中标签文本是彩色的(以指示数据点来自哪个组)。

我目前正在使用 heatmap.2,但很乐意使用另一个包。

heatmap.2(data.matrix(data),trace = 'none', dendrogram='none',ColSideColors=col)

此调用为我提供了标签上的彩色条 (ColSideColors),但我想让标签本身着色。

非常感谢!

最佳答案

您将需要创建一个包含 col.axis 的新函数。争论。这些是要使用的函数行:

# there were four long pages of code before this section:

axis(1, 1:nc, labels = labCol, las = 2, line = -0.5, tick = 0, # original line
        col.axis="green",   # added argument
        cex.axis = cexCol)
if (!is.null(xlab)) 
        mtext(xlab, side = 1, line = margins[1] - 1.25)
axis(4, iy, labels = labRow, las = 2, line = -0.5, tick = 0, # original line
        col.axis="green",   # added argument
        cex.axis = cexRow)

关于r - R 热图中的颜色标签(文本),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13206335/

相关文章:

读取模板文件并在一些修改后将其写入磁盘

r - 不同 ggplot2 图中的重复命令

javascript - 通过 HEX 或 RGB 获取颜色名称

R : what library should I use? 中的图像处理/颜色检测

javascript - 在javascript中检查颜色值

python - seaborn 热图的人工刻度标签

r - 错误: Continuous value supplied to discrete scale in ggplot2 while using scale_colour_hue

R. 四舍五入到特定位数。小数点无关

python Bokeh ,如何制作相关图?

r - heatmap.2 颜色真的很奇怪