繁体   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