Reset par to the default values at startup

前端 未结 6 1115
情书的邮戳
情书的邮戳 2020-12-02 07:52

Normally when I make my own plot functions, I make a construct :

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

which is the standard way

6条回答
  •  长情又很酷
    2020-12-02 08:11

    An alternative solution for preventing functions to change the user par. You can set the default parameters early on the function, so that the graphical parameters and layout will not be changed during the function execution. See ?on.exit for further details.

    on.exit(layout(1))
    opar<-par(no.readonly=TRUE)
    on.exit(par(opar),add=TRUE,after=FALSE)
    

提交回复
热议问题