如何使用gplots
中的heatmap.2
函數在同一頁上生成3個熱圖,其中每個熱圖具有相同的行寬,以便每個熱圖的長度熱圖與其行數成正比?用R中的比例長度圖繪製頁面的3次
我對一些虛擬數據的不正確嘗試如下。我認爲問題的一部分是heatmap.2
函數啓動一個新的情節,這意味着layout
沒有幫助。
gs <- paste("GS",sample(10),sep="_")
mat1 <- matrix(rnorm(100), nrow=10, ncol=10, dimnames=list(sample.int(10000,10),gs))
mat2 <- matrix(rnorm(150), nrow=15, ncol=10, dimnames=list(sample.int(10000,15),gs))
mat3 <- matrix(rnorm(200), nrow=20, ncol=10, dimnames=list(sample.int(10000,20),gs))
nf <- layout(matrix(c(1,2,3),3,1), widths = lcm(5), heights = lcm(5), TRUE)
layout.show(nf)
library(gplots)
heatmap.2(mat1, Rowv=F, Colv=F,col=greenred(200), scale="row",
key=TRUE, symkey=FALSE, density.info="none", trace="none", dendrogram="none",
labCol=colnames(mat1), labRow=rownames(mat1), keysize=0.8)
heatmap.2(mat2, Rowv=F, Colv=F,col=greenred(200), scale="row",
key=TRUE, symkey=FALSE, density.info="none", trace="none", dendrogram="none",
labCol=colnames(mat2), labRow=rownames(mat2), keysize=0.8)par(mar = c(3,0,1,1))
heatmap.2(mat3, Rowv=F, Colv=F,col=greenred(200), scale="row",
key=TRUE, symkey=FALSE, density.info="none", trace="none", dendrogram="none",
labCol=colnames(mat3), labRow=rownames(mat3), keysize=0.8)
那是你的問題沒事。 'heatmap.2使用'佈局'本身,它覆蓋了你的規範。 –
無論如何用'grid'包裝來做到這一點? – user1447630
我會看看gridBase包。 –