Dear R users, I have been plotting several graphics in only one page. I intend to plot only one legend in each page. Since the graphics are inside a loop I have to do it automatically. The main problem is that inside the loop I work with differente types of variables, I mean , the range is different for each one. I have already tried : par(xpd=TRUE) pos<-par("usr") legend(pos[1],pos[3]-(pos[3]*.05),c("Modelo","Observado"),col c("blue","orange"),cex=1.0, pch=15) I would like to be able to plot the legend outer the graphics region. Something like I've done with title. You can see one figure an attached file. I really appreciate any help. Nilza Barros -- Abra?o, Nilza Barros
Increase the margins (see argument mar in ?par) and plot the legend outside after allowing to do so by changing the clipping region by par(xpd=TRUE). Uwe Ligges On 22.04.2010 22:35, Nilza BARROS wrote:> Dear R users, > > I have been plotting several graphics in only one page. I intend to plot > only one legend in each page. > Since the graphics are inside a loop I have to do it automatically. > The main problem is that inside the loop I work with differente types of > variables, I mean , the range is different for each one. > > I have already tried : > > par(xpd=TRUE) > pos<-par("usr") > legend(pos[1],pos[3]-(pos[3]*.05),c("Modelo","Observado"),col > c("blue","orange"),cex=1.0, pch=15) > I would like to be able to plot the legend outer the graphics region. > Something like I've done with title. > You can see one figure an attached file. > > I really appreciate any help. > Nilza Barros > > > > > > > > > > > ______________________________________________ > R-help at 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.
Look at the grconvertX and grconvertY functions. -- 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 Nilza BARROS > Sent: Thursday, April 22, 2010 2:35 PM > To: r-help at r-project.org > Subject: [R] legend problem > > Dear R users, > > I have been plotting several graphics in only one page. I intend to > plot > only one legend in each page. > Since the graphics are inside a loop I have to do it automatically. > The main problem is that inside the loop I work with differente types > of > variables, I mean , the range is different for each one. > > I have already tried : > > par(xpd=TRUE) > pos<-par("usr") > legend(pos[1],pos[3]-(pos[3]*.05),c("Modelo","Observado"),col > c("blue","orange"),cex=1.0, pch=15) > I would like to be able to plot the legend outer the graphics region. > Something like I've done with title. > You can see one figure an attached file. > > I really appreciate any help. > Nilza Barros > > > > > > > > -- > Abra?o, > Nilza Barros