The on.exit() function is handy for variable clean up if global variables must be assigned.
Some parameters, especially those for graphics, can only be set globally. This small function is common when creating more specialized plots.
new_plot <- function(...) {
old_pars <- par(m...