簡體   English   中英

如何在heatmap.2()中縮短ColSideColors的高度

[英]How to shorten the height of ColSideColors in heatmap.2()

我的以下代碼:

library(gplots);
library(RColorBrewer);

dat <- read.table("http://pastebin.com/raw.php?i=wM7WxEvY",sep="\t",na.strings="NA",header=TRUE)
dat <- dat[complete.cases(dat),]
dat.log <- log2(dat);

# Clustering and distance function
hclustfunc <- function(x) hclust(x, method="ward")
distfunc <- function(x) dist(x,method="maximum")

# Here we cluster based on the Celltype (Column)
d <- distfunc(t(dat.log))
fit <- hclustfunc(d)
clusters <- cutree(fit, h=20)
nofclust.height <-  length(unique(as.vector(clusters)));


# Colors setting 
hmcols <- rev(redblue(256));
selcol <- colorRampPalette(brewer.pal(9,"Set1"))
clustcol.height = selcol(nofclust.height);


pdf(file="temp.pdf",width=30,height=40);
heatmap.2(as.matrix(dat.log),Colv=FALSE,lhei = c(0.25,4),ColSideColors=clustcol.height[clusters],density.info="none",scale="none",margin=c(10,10),col=hmcols,symkey=F,trace="none",dendrogram="none",keysize=1,hclust=hclustfunc,distfun=distfunc);
dev.off();

生成此圖: 在此處輸入圖片說明

請注意, ColSideColors太高。 如何縮短呢?

?heatmap.2 :用於布局RowSideColorColSideColor “。可以通過用於lmat,lwid和lhei specifiying適當的值被重寫lmat控制每個元件的相對位置,而lwid控制列寬度和lhei控制行高度請參閱幫助頁面以獲取有關如何使用這些參數的詳細信息的布局 。”

在您的情況下,您必須更改lhei,嘗試lhei=c(1,15)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM