【问题标题】:How to adjust column labels in heatmap.3如何调整 heatmap.3 中的列标签
【发布时间】:2015-11-17 16:53:16
【问题描述】:

以下是我的 heatmap.3 代码:

heatmap.3(x = as.matrix(res), dist.FUN = dist2, scale = 'row', color.FUN = col_ylgnbu, 
                           cex.main = 2, trace = 'none', srtCol = 45, adjCol = c(1,0.1),
                           main = paste(title), 
                           key = T, cexRow = 2, cexCol = 1)

我使用此代码得到以下热图:

我的问题是如何调整列标签以使其不与热图重叠?

谢谢!

【问题讨论】:

    标签: r heatmap


    【解决方案1】:

    您可以将 adjCol 设置为居中对齐,offsetCol 将标签向下移动:

    heatmap.3(x = as.matrix(res), dist.FUN = dist2, scale = 'row', 
        color.FUN = col_ylgnbu, 
        cex.main = 2, trace = 'none', srtCol = 45, 
        adjCol = c(1,0), offsetCol=1
        main = paste(title), 
        key = T, cexRow = 2, cexCol = 1)
    

    更多注释:http://earlglynn.github.io/RNotes/package/gplots/heatmap2.html

    【讨论】:

    • 它给了我以下错误:In plot.window(...) : "adjCol" is not a graphical parameter In plot.window(...) : "offsetCol" is not a graphical parameter
    • 看脚本,adjCol 应该只在 srtCol 为 NULL 的情况下才有效,你之前看到过这个错误吗?
    • 是的,我以前也看到过这个错误。我确实希望列名旋转 45 度并垂直调整。所以我想我会同时使用 adjCol 和 srtCol。但是,似乎 heatmap.3 并没有像众所周知的那样真正继承 heatmap.2 的所有参数。
    • 是的,添加文本时似乎有问题,没有更改文本位置的选项。 text(1:nc,.sideCol,labels=labCol,srt=srtCol,pos=1,xpd=TRUE,cex=cexCol)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-24
    • 2015-12-19
    • 1970-01-01
    • 2016-07-05
    相关资源
    最近更新 更多