Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove left white space in heatmap.2 output

Tags:

plot

r

heatmap

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.

like image 227
pdubois Avatar asked Feb 14 '23 09:02

pdubois


1 Answers

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.

like image 70
TWL Avatar answered Feb 17 '23 10:02

TWL