Thank you very much! I was able to solved this probem for your advices.
Dear all,
I would like to output the heat map with colorkey on top. However, colorkey will not be displayed when using the following command.
heatmap.2(as.matrix(data.z),
col=colorRampPalette(c("blue3", "white", "red3")),
scale="none",
key=TRUE,
symkey=FALSE,
density.info="none",
trace="none",
cexRow=0.5,
cexCol = 1,
Colv = FALSE,
lmat = rbind(c(0,4,0),c(2,1,0),c(0,3,0)),
lwid=c(1,10,0.5),lhei=c(1,6,0)
)
The error message shows the following.
Error in plot.new() : outer margins too large (figure region too small)
In addition: Warning message:
In heatmap.2(as.matrix(data.z), col = colorRampPalette(c("blue3", :
Discrepancy: Colv is FALSE, while dendrogram is `both'. Omitting column dendogram.
What problems does my command have?
Thank you
1 answer
You have a 0 dimension for your bottom row height. Changing it to: lwid=c(1,10,0.5),lhei=c(3,6,1) gives a valid plot.
However, you're calling 9 positions in lmat, when there are only 4 things to plot, and you're turning off one of the dendrograms, so there's only three things to plot. heatmap.2 plots (1) heat map, (2) row dendrogram, (3) column dendrogram, and (4) key, and it does so like this: matrix(c(4,3,2,1),2,2, byrow=TRUE)
Your call to lmat adds an extra column and row to the layout. You can get essentially the same plot with:
heatmap.2(matrix(rnorm(100), 10, 10)
, col=colorRampPalette(c("blue3", "white", "red3"))
, scale="none"
, key=TRUE
, symkey=FALSE
, density.info="none"
, trace="none"
, cexRow=0.5
, cexCol = 1
, Colv = FALSE
, lmat=rbind(c(3,4),c(2,1))
)
Log in to answer this question.