Reset par for default values ​​at startup

Usually, when I perform my own build functions, I make a construct:

op <- par("mypar"=myvalue) on.exit(par(op)) 

which is the standard way to return par to previous values. Imagine that you performed some functions that changed some parses, and you need to reset the default values ​​when starting in R. What is a convenient way to do this?

Or in other words: how to reach default values ​​for par() ?

+68
r default par
Apr 26 '11 at 12:01
source share
3 answers

Each time a new device is opened, par () will reset, so the other option just does dev.off() and continue.

+79
Aug 09 '15 at 21:28
source share

This is hacked, but:

 resetPar <- function() { dev.new() op <- par(no.readonly = TRUE) dev.off() op } 

works after the mod, but he temporarily launched a new device on the screen ...

eg:.

 > par(mfrow = c(2,2)) ## some random par change > par("mfrow") [1] 2 2 > par(resetPar()) ## reset the pars to defaults > par("mfrow") ## back to default [1] 1 1 
+51
Apr 26 '11 at 12:39 on
source share

From Quick-R

 par() # view current settings opar <- par() # make a copy of current settings par(col.lab="red") # red x and y labels hist(mtcars$mpg) # create a plot with these new settings par(opar) # restore original settings 
+12
May 31 '13 at 14:41
source share



All Articles