[R] Q: calling par() in .First()

Greg Snow Greg.Snow at intermountainmail.org
Mon Aug 6 19:32:21 CEST 2007


Be aware that the effects of calls to par usually only last for the
duration of the graphics device, not the R session.  If you put a call
to par in your startup script, then it will open a graphics device and
set the option, but if you close that graphics device and do another
plot then a new graphics device will be started with the default
parameters rather than what you set in the startup script.  

You can set some of the options (including background color) when
starting a graphics device, that may be the better option.

There was some discussion a while back on having global options for some
of the graphics defaults, but I don't think anything has been
implemented yet.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of D. R. Evans
> Sent: Monday, August 06, 2007 9:26 AM
> To: r-help at stat.math.ethz.ch
> Subject: Re: [R] Q: calling par() in .First()
> 
> Thomas Lumley said the following at 08/02/2007 05:25 PM :
> 
> > 
> > par() is in the 'graphics' package, which is not loaded by the time 
> > .Rprofile runs.  You want graphics::par(bg='white')
> > 
> 
> Thank you, but when I tried that, I got:
> 
>   Error in graphics::par(bg = "white") : couldn't find function "X11"
> 
> However, executing an explicit "library(graphics)" seems to 
> do the trick.
> Your hint about the graphics package was what gave me the 
> clue to try this; thank you.
> 
> > Information from which this can be deduced and examples are in 
> > ?Startup, though it isn't explicitly stated there.
> > 
> 
> You are obviously much better at deducing information than I 
> am. I had read that quite carefully before posting my 
> question -- and I just went back and re-read it to see what I 
> had missed, and I can't see anything that even hints at any 
> of this :-(
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list