Skip to content

Commit

Permalink
Add on.exit() to restore par() after plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
EeethB committed Jul 10, 2024
1 parent 97f0372 commit 3017139
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/plot.initial_graph.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ plot.initial_graph <- function(x,
eps = NULL,
background_color = "white",
margins = c(0, 0, 0, 0)) {
oldpar <- par("bg", "mar")
on.exit(suppressWarnings(par(oldpar)))

if (length(v_palette) != 2) {
stop("Choose 2 palette colors or use `vertex.color` for more customization")
}
Expand Down
Binary file modified tests/testthat/Rplots.pdf
Binary file not shown.

0 comments on commit 3017139

Please sign in to comment.