我有:
library(gplots);
x<-matrix(seq(1:100),nrow=10,byrow=TRUE);
heatmap.2(x, Rowv=NA, Colv=NA, scale="none", main="This title will be cut off by the white space where the non-existant key is supposed to go.", col=gray((255:0)/255), dendrogram="none",trace="none", key=FALSE);当键被指定为FALSE时,在绘图的左侧有一块空白区域,它阻止显示完整的标题,与手动指定的较小页边距冲突,并将热图向右移动。空白的宽度是可以使用"keysize=#"控制的,但是将其设置得太小(介于0.8和1.0之间)会产生错误:"Error in plot.new() : figure margins too large"
我会尝试用heatmap()而不是heatmap.2()来做这件事,但是heatmap在par()上不能很好地工作,这是我在项目中需要的。如果任何人有任何建议,我将不胜感激。
发布于 2013-05-22 16:03:06
可以使用布局参数来定位heatmap.2图的元素。
layout(mat = lmat, widths = lwid, heights = lhei)使用下面的代码,我得到了一个可以接受的热图。
heatmap.2(x,
Rowv=NA,
Colv=NA,
scale="none",
main="This title will be cut off by the white space where the non-existant key is supposed to go.",
col=gray((255:0)/255),
dendrogram="none",
trace="none",
key=FALSE,
lmat=rbind(c(2),c(3),c(1),c(4)),
lhei=c(1,1,9,0),
lwid=c(1)
);有关更多详细信息,请参阅?layout或this answer on Stack Exchange。
https://stackoverflow.com/questions/16683026
复制相似问题