![](/img/trans.png)
[英]R - gplots - Removing white space in heatmap.2 when key=FALSE
[英]How to remove left white space in heatmap.2 output
有了这段代码
library(gplots)
# Read data
dat <- read.table("http://dpaste.com/1501148/plain/",sep="\t",header=T);
rownames(dat) <- dat$Name
dat <- dat[,!names(dat) %in% c("Name")]
#Set colour
hmcols <- rev(redgreen(2750));
pdf("~/Desktop/tmp.pdf")
# Plot the figure, we don't want KEY in the plot and no dendrograms also.
heatmap.2(as.matrix(dat),Colv=FALSE,dendrogram="none",scale="row",col=hmcols,trace="none", margin=c(5,15), lwid=c(1.5,2.0),key=FALSE);
dev.off()
输出如下图:
请注意,左侧有太多空白区域。 我该如何删除它? 原则上我想做整个热图的左对齐。
这可以使用layout
参数来完成: lhei
和lwid
,它们控制绘图的高度和宽度。
在你的情况下,尝试: lwid=c(0.1,4), lhei=c(0.1,4)
有关如何在heatmap.2
使用layout
参数的更多详细信息,请参阅此文章 。
在预览中打开它(这是从路径判断的Mac上)使用工具/选择工具/裁剪到所需的配置并复制/ cmd-C。 然后从剪贴板/文件/新建:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.