[R] set par options once for entire R session

MacQueen, Don macqueen1 at llnl.gov
Wed Jun 24 17:40:02 CEST 2015


The Details section of ?par starts of with:

 "Each device has its own set of graphical parameters."

(So this is not Mac-specific.)

Strictly speaking, the options you set with par() are not "reset" when you
open a new graphics device. Rather, when a new device is opened, it is
initialized with default values of graphics parameters.

If you can find where those default values are stored (in a brief search I
did not find them), then perhaps you can change them at session startup
time.

I haven't tested this, but you might be able to make things a little more
convenient by defining a function

  mypar <- function() par( {set whatever values you want} )

Then whenever you open a new device, immediately call that function:

pdf()
mypar()
plot(x,y)
dev.off()

png()
mypar()
plot(x,y)
dev.of()

And so on.



-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 6/23/15, 8:54 AM, "R-help on behalf of Martin Batholdy via R-help"
<r-help-bounces at r-project.org on behalf of r-help at r-project.org> wrote:

>Hi,
>
>I would like to set plot-options via par() and keep them for all plots
>that are created thereafter.
>Currently after each plot device the parameters I can set with par() are
>reseted to their default value, at least on a Mac (R 3.2.1).
>
>Is there a way to define the parameters for plotting once at the
>beginning and then keep them for an entire R session?
>
>
>Thank you!
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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