[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() 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(x) title(main=expression("1- residuals distribution")) abline(0,0,lwd=2,col=2) boxplot(x) title(main=expression("2- residuals distribution")) abline(0,0,lwd=2,col=2) boxplot(x) 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]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] use of empty space in split graph device
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 [EMAIL PROTECTED] 801.408.8111 > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of Benoit Boulinguiez > Sent: Friday, October 17, 2008 7:30 AM > To: r-help@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() 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(x) > title(main=expression("1- residuals distribution")) > abline(0,0,lwd=2,col=2) > boxplot(x) > title(main=expression("2- residuals distribution")) > abline(0,0,lwd=2,col=2) > boxplot(x) > 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]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] use of empty space in split graph device
That's it. thanks Regards/Cordialement Benoit Boulinguiez -Message d'origine- De : Greg Snow [mailto:[EMAIL PROTECTED] Envoyé : vendredi 17 octobre 2008 19:19 À : Benoit Boulinguiez; r-help@r-project.org Objet : RE: [R] use of empty space in split graph device 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 [EMAIL PROTECTED] 801.408.8111 > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of Benoit Boulinguiez > Sent: Friday, October 17, 2008 7:30 AM > To: r-help@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() 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(x) > title(main=expression("1- residuals distribution")) > abline(0,0,lwd=2,col=2) > boxplot(x) > title(main=expression("2- residuals distribution")) > abline(0,0,lwd=2,col=2) > boxplot(x) > 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]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.