gpt4 book ai didi

R 中的最近热图 2

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

我使用以下代码使用 R 的 heatmap.2 生成热图。 key="F"去掉了顶部的颜色键。然而,绘图不会重新缩放,在之前由颜色键占据的位置留下空白区域。如何通过消除顶部的空白来重新调整情节?

dImp_heatmap <- heatmap.2(dSet_matrix, Rowv=NA, Colv=NA, col = cm.colors(20), dendrogram="none",trace="none", key="F",margins=c(1,8),colsep=c(1:6),rowsep=(1:62),sepwidth=c(0.05,0.05), sepcolor="white", cellnote=round(dSet_matrix,digits=2),notecol="black",notecex=0.7,scale="column")

最佳答案

如果您仔细阅读 ?heatplot.2 的文档,您将在参数列表的底部看到以下内容:

lmat, lhei, lwid visual layout: position matrix, column height, column width. See below for details

详细信息是:

This layout can be overriden by specifiying appropriate values for lmat, lwid, and lhei. lmat controls the relative postition of each element, while lwid controls the column width, and lhei controls the row height. See the help page for layout for details on how to use these arguments.

例如:

data(mtcars)
x <- as.matrix(mtcars)
rc <- rainbow(nrow(x), start=0, end=.3)
cc <- rainbow(ncol(x), start=0, end=.3)

##
## demonstrate the effect of row and column dendrogram options
##
gplots:::heatmap.2(x,key = FALSE,dendrogram = "row",lhei = c(0.05,0.95))

enter image description here

我想设置lwid会有类似的行为。尽管我应该补充一点,如果您包含两个树状图,则需要左上角的空间来为树状图腾出空间。

关于R 中的最近热图 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9777411/

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