Skip to content

Commit

Permalink
specify graphics::par and add another on.exit call
Browse files Browse the repository at this point in the history
  • Loading branch information
shwilks committed Sep 1, 2023
1 parent 6ff8b8c commit 427a0fc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/map_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ plot.acmap <- function(

# Setup plot
if (!is.null(margins)) {
oldpar <- par(no.readonly = TRUE)
on.exit(par(oldpar)) # Restore original parameters on exit
oldpar <- graphics::par(no.readonly = TRUE)
on.exit(graphics::par(oldpar)) # Restore original parameters on exit
graphics::par(mar = margins) # Set user defined margins
}
graphics::plot.new()
Expand Down Expand Up @@ -467,7 +467,9 @@ setup_acmap <- function(

# Set up plot
if (newplot) graphics::plot.new()
graphics::par(mar = mar)
oldpar <- graphics::par(no.readonly = TRUE)
on.exit(graphics::par(oldpar)) # Restore original parameters on exit
graphics::par(mar = mar) # Set user defined margins
graphics::plot.window(
xlim = x_range,
ylim = y_range,
Expand Down

0 comments on commit 427a0fc

Please sign in to comment.