[R] Make my plots bigger and reduce white space around panels?

Greg Snow Greg.Snow at imail.org
Wed Jul 29 17:43:04 CEST 2009


It still was not attached, but you can reduce the white space by reducing the margins using par(mar=c(...)).

If you do par(mar=c(0,0,0,0)), then there will be no space between the plots, using values larger than 0 will give space.  But beware, you need to either suppress the plotting of axis labels/ticks or make them smaller and closer to the axes, or you will end up with the axis label for one plot inside of another.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Mark Na
> Sent: Tuesday, July 28, 2009 4:53 PM
> To: r-help at r-project.org
> Subject: Re: [R] Make my plots bigger and reduce white space around
> panels?
> 
> The plot is attached this time...
> 
> On Tue, Jul 28, 2009 at 4:47 PM, Mark Na <mtb954 at gmail.com> wrote:
> 
> > Hi,
> >
> > I have made a plot with panels (attached) using R code (below) and
> I'd like
> > to increase the size of each panel and decrease the white space,
> especially
> > the white space between:
> >
> > 1. rows of panels
> > 2. the top panel and its title (which contains info on r2 and N)
> > 3. each panel and its x label.
> >
> > I've dug around in the plot help files but can't seem to find how to
> do
> > this.
> >
> > Any help much appreciated, thanks!
> >
> > Mark Na
> >
> >
> >
> >
> > #####ELEPHANT SPECIES RICHNESS
> > par(mfrow=c(3,4),oma=c(0,0,2,0))
> > models<-list(data$SR.elephant.obs~data$AREA,
> >              log(data$SR.elephant.obs+1,10)~log(data$AREA,10),
> >              data$SR.elephant.obs~log(data$AREA,10),
> >              log(data$SR.elephant.obs+1,10)~data$AREA)
> > for (i in 1:length(models)){ #SCATTERPLOT
> > model<-lm(models[[i]])
> > plot(models[[i]],ylab="Elephant SR");
> >
> abline(model);title(main=paste("r2=",round(summary(model)$r.squared,dig
> its=3),",
> > N=",dim(data)[1]))
> > }
> > for (i in 1:length(models)){#RESIDUALS VS FITTED VALUES PLOT
> > model<-lm(models[[i]])
> > plot.lm(model,which=1,sub.caption=NA)
> > }
> > for (i in 1:length(models)){#Q-Q PLOT
> > model<-lm(models[[i]])
> > plot.lm(model,which=2,sub.caption=NA)
> > }
> > title(main="ELEPHANT SPECIES RICHNESS",outer=TRUE);
> > savePlot("SR_elephant.emf",type="emf"); dev.off()
> >
> 
> 
> 
> --
> Mark Na
> University of Saskatchewan
> Saskatoon, Canada




More information about the R-help mailing list