Michael Friendly
2007-Sep-29 19:43 UTC
[R] resetting par() to all defaults: par(reset=TRUE) ?
In a long session, producing multiple graphs, I sometimes repeatedly change par() settings, particularly with multi-row/col displays. If I'm using a script, I'll do op <- par(newsettings) ... plots ... par(op) but sometimes I do things on the fly and can't easily back out to the default settings. I'm looking for someway to do the equivalent of par(reset=TRUE) I suppose I could do something like create Rprofile.site containing .First <- function() par.default <- par() and then par(par.default), but maybe there's an easier way I haven't noticed. [On Windows, I don't use Rprofile.site because it's one more thing to update with each new version.] -Michael -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html Toronto, ONT M3J 1P3 CANADA
deepayan.sarkar at gmail.com
2007-Sep-30 03:32 UTC
[R] resetting par() to all defaults: par(reset=TRUE) ?
On 9/29/07, Michael Friendly <friendly at yorku.ca> wrote:> In a long session, producing multiple graphs, I sometimes repeatedly > change par() settings, particularly with multi-row/col displays. > If I'm using a script, I'll do > > op <- par(newsettings) > ... plots ... > par(op) > > but sometimes I do things on the fly and can't easily back out > to the default settings. I'm looking for someway to do the > equivalent of > > par(reset=TRUE)par()s get reset every time a new device is opened, so one option is to just close the device (dev.off()) and continue. -Deepayan
Michael Friendly wrote:> > In a long session, producing multiple graphs, I sometimes repeatedly > change par() settings, particularly with multi-row/col displays. > If I'm using a script, I'll do > > op <- par(newsettings) > ... plots ... > par(op) > > but sometimes I do things on the fly and can't easily back out > to the default settings. I'm looking for someway to do the > equivalent of > > par(reset=TRUE) > > I suppose I could do something like create Rprofile.site containing > > .First <- function() par.default <- par() > > and then par(par.default), but maybe there's an easier way I haven't > noticed. [On Windows, I don't use Rprofile.site because it's one more > thing to update with each new version.] > > -Michael >Your solution seems pretty good to me (although I often use Deepayan's dev.off(); windows() hack myself), but I would amend it to par.default <- par(no.readonly=TRUE) Ben -- View this message in context: http://www.nabble.com/resetting-par%28%29-to-all-defaults%3A-par%28reset%3DTRUE%29---tf4540681.html#a12966877 Sent from the R help mailing list archive at Nabble.com.