R – How to remove left white space in heatmap.2 output

heatmapplotr

With this code

 library(gplots)

 # Read data
 dat <- read.table("http://dpaste.com/1501148/plain/",sep="\t",header=T);
 rownames(dat) <- dat$Name
 dat <- dat[,!names(dat) %in% c("Name")]

 #Set colour
 hmcols <- rev(redgreen(2750));

 pdf("~/Desktop/tmp.pdf")

 # Plot the figure, we don't want KEY in the plot and no dendrograms also.
 heatmap.2(as.matrix(dat),Colv=FALSE,dendrogram="none",scale="row",col=hmcols,trace="none",  margin=c(5,15), lwid=c(1.5,2.0),key=FALSE);
 dev.off()

It output the following figure:
enter image description here

Note that it has too many white space on the left.
How can I remove it?
In principle I want to do left-justify of the whole heatmap.

Best Answer

This can be done using layout parameters: lhei and lwid, which control the hight and the width of the plot.

In your case, try: lwid=c(0.1,4), lhei=c(0.1,4)

Please refer to this post for more details on how to use layout parameters within heatmap.2.

Related Topic