Re: [R] set par options once for entire R session
Hi Martin, Depending upon what device parameters you want to set, you can write a wrapper for the device call that includes the parameters: my.x11<-function() { x11(family="sans",font=2) } Then just call the wrapper instead of the device function. You could make a little package with all of the devices you wish to use and just load the package at the beginning of your R session. Jim On Thu, Jun 25, 2015 at 1:40 AM, MacQueen, Don wrote: > 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" > 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@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. > > __ > R-help@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. __ R-help@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.
Re: [R] set par options once for entire R session
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" 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@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. __ R-help@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.
Re: [R] set par options once for entire R session
Martin: One simple approach: write your own graphics functions that are simple wrappers to the plot functions you use that set the par() values as you wish. You could even put them in a package that is loaded at startup. See ?Startup My understanding is that so long as a graphics device remains open, new plots on it will reuse the same par() settings. See,e.g. ?plot.new. Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Tue, Jun 23, 2015 at 8:54 AM, Martin Batholdy via R-help 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@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. __ R-help@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.
[R] set par options once for entire R session
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@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.