Closed renkun-ken closed 2 years ago
The "clean" button in RStudio kills the graphics device which results in par
being reset.
This seems to be the recommended way of resetting par
(https://stackoverflow.com/questions/5789982/reset-par-to-the-default-values-at-startup).
In httpgd this would mean that the webserver had to be shut down and restarted, which I think we should avoid.
Do you shink we should make a copy of the par
arguments as suggested by the second answer of the stackoverflow link:
opar <- par() # on startup
# ...
par(opar) # on "clean"
Or is resetting the mfrow argument after clean sufficient?
par(mfrow = c(1, 1))
I am not exactly sure what other settings of par
are commonly used.
This is an old session, but I do think it's more convenient if there's a button or command to reset the par
. Is it possible to save a default par
object when startup and add a button on the toolbar of the plot window to reset par
? if that's easier than killing the server and restarting it. Thanks.
Thank you for your request, I agree and have added it to the 1.3 tracking issue.
Thank you for waiting patiently. I just added a parameter
hgd(
... ,
reset_par = getOption("httpgd.reset_par", FALSE)
)
that toggles this functionality.
Does it make sense to reset
par
on clear (RStudio behavior)?For, example, the following code uses
par()
before plot.Then if users clicks
Clear
button, then the plot is gone.The difference appears when user then creates a new simple plot:
In RStudio, when the plot is all cleared, the
par
is reset too so that a new plot will revert topar(mfrow = c(1, 1))
. In httpgd at the moment, it is not reverted to defaultpar
.I'm wondering which makes more sense?