[R] use of empty space in split graph device

Greg Snow Greg.Snow at imail.org
Fri Oct 17 19:19:09 CEST 2008


The plot.new function will start a new plot in the next frame, but not plot anything.  By default the coordinates go from 0 to 1 in both the x and y directions.

Try:

> par(mfrow=c(2,2))
> boxplot(rnorm(100))
> boxplot(runif(100))
> boxplot(rexp(100, 1/3))
> plot.new()
> legend( 0,1, pch=1:3, legend=c('a','b','c'), lty=1, col=c('red','green','blue'))
>

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 Benoit Boulinguiez
> Sent: Friday, October 17, 2008 7:30 AM
> To: r-help at r-project.org
> Subject: [R] use of empty space in split graph device
>
> Hi all,
>
> I divide the graphical device into 4 ---mfrow=c(2,2)--- to plot 3
> boxplots graph.
> Thus I get an empty space for the fourth graph. I d'like to place a
> legend in this space.
>
> legend(xxxx) creates a legend in the last graph (the 3rd) I'd like a
> legend in the empty space.
>
> How may I do it?
>
> #graph parameter
> par( fin=c(6,6),   #dim graph
>  mai=c(1,1,0.5,0.5) #marges graph
>  ,mfrow=c(2,2)
>  )
> #boxplots
> boxplot(xxxxx)
> title(main=expression("1- residuals distribution"))
> abline(0,0,lwd=2,col=2)
> boxplot(xxxxx)
> title(main=expression("2- residuals distribution"))
> abline(0,0,lwd=2,col=2)
> boxplot(xxxxx)
> title(main=expression("3- residuals distribution"))
> abline(0,0,lwd=2,col=2)
>
>
>
> Regards/Cordialement
>
> -------------
> Benoit Boulinguiez
> Ph.D
> Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 Equipe CIP UMR CNRS 6226
> "Sciences Chimiques de Rennes"
> Campus de Beaulieu, 263 Avenue du Général Leclerc 35700 Rennes, France
> Tel 33 (0)2 23 23 80 83 Fax 33 (0)2 23 23 81 20 http://www.ensc-
> rennes.fr/
>
>
>
>         [[alternative HTML version deleted]]



More information about the R-help mailing list