2013-12-19 1 views
2

내 다음 코드 : ColSideColors가 너무 높은 것을 enter image description hereheatmap.2에서 ColSideColors의 높이를 단축하는 방법()

참고 :

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(); 

이 그림을 생성합니다. 어떻게 단축시킬 수 있습니까?

답변

1

?heatmap.2 다음 RowSideColorColSideColor의 레이아웃은 "lmat, lwid 및 lhei 적절한 값을 specifiying 의해 재정의 될 수 lmat 각 요소의 상대적인 위치를 제어 lwid 제어 칼럼 폭, lhei 컨트롤 로우있다. 이러한 인수를 사용하는 방법에 대한 자세한 내용은 layout에 대한 도움말 페이지를 참조하십시오. " 귀하의 경우에는

, 당신은 lhei을 변경 lhei=c(1,15)

+1

당신은 패키지 문서를 인용하는 것보다 좀 더 구체적으로 수하려고합니다. OP에주의를 기울이면 이미 '이'가 사용되고 있습니다. 1과 15의 논증은 무엇을 의미합니까? 라인 높이를 노골적으로 바꾸면 오류 메시지가 생성됩니다. l' : plot.new() 오류 : 그림 여백이 너무 큽니다. ' – posdef