[英]R - gplots - Removing white space in heatmap.2 when key=FALSE
我有:
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.2()
heatmap()
而不是heatmap.2()
,但是熱圖不能很好地用於項目所需的par()
。 如果有人有任何建議,我會很感激。
可以使用布局參數完成熱圖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)
);
有關詳細信息,請參閱Stack Exchange上的 ?layout
或此答案 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.