我有以下数据:
foo_06.ix bar_06.ix bar_06.iz qux_06.ix qux_06.iz 1416474_at Igdcc4 0.563 5.649 1.654 0.776 0.973 1416576_at Socs3 5.793 5.417 0.694 3.256 0.951 ...
我想绘制层次聚类热图.
使用此代码:
library(gplots); library(RColorBrewer); tm <- read.table("http://dpaste.com/1494806/plain/",header=TRUE,sep="\t") nofclust <- 21; # Clustering functions hclustfunc <- function(x) hclust(x, method="complete") distfunc <- function(x) dist(x,method="euclidean") d.tm <- distfunc(tm) fit.tm <- hclustfunc(d.tm) clusters <- cutree(fit.tm, k=nofclust) # Define colours hmcols <- rev(brewer.pal(11,"Spectral")); selcol <- colorRampPalette(brewer.pal(12,"Set3")) selcol2 <- colorRampPalette(brewer.pal(9,"Set1")) sdcol= selcol(5); clustcol = selcol2(nofclust); # Plot heatmap pdf(file="tmp.pdf",width=27,height=27); heatmap.2(as.matrix(tm),dendrogram="row",scale="row",RowSideColors=clustcol[clusters],ColSideColors=sdcol,col=hmcols,trace="none", margin=c(12,12), hclust=hclustfunc,distfun=distfunc,lwid=c(0.1,0.1,0.1,0.1,0.1),keysize=0.5); dev.off()
它产生如下图:
使用固定的PDF大小(27x27)我想做的事情:
创建row side column
小于所有5个主列的热图.目前它太宽了.这5个主要列的大小我固定lwid=0.1
,所以不要改变.
挤压树形图.
如果上述两个生效,则右侧的行名占据页面中的显着空格.
如何修改上面的代码才能实现这些目标?