On 14/05/2010 3:51 PM, David Winsemius wrote:
Some of the help page examples use the form:

opar <- par(<something>)
     .....plotting activities...
par(opar)

This seems to "work" well, yet I have read in some places

Please include commented, retrievalbe citations for "some places".

that it is not the preferred method to keep you parameters from getting corrupted. What is the preferred method?


The above, with the restore wrapped in on.exit(), as your sources should have said.

Duncan Murdoch

A worked example from a recent posting with minor additions:

   opar <- par(mar=c(3,5,0,5))
        layout(rbind(c(4,1,1,5), c(2,2,3,3)), widths=c(1,1,1,1),
                           heights=c(.75,2.25))
           barplot(0,0, axes=FALSE)
             legend(x=0.5, y=0, legend=c("Example 1", "Example 2"),
                   pch=c(1,2), cex=1.5, xjust=1, yjust=0.5, bty="n")
         plot(1:10,1:10, pch=1)
         plot(1:20,1:20, pch=2)
  par(opar)



______________________________________________
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.

Reply via email to