From 30171390b871c84b74603e24cdb9a262a657981a Mon Sep 17 00:00:00 2001 From: EeethB Date: Wed, 10 Jul 2024 11:55:42 -0500 Subject: [PATCH] Add `on.exit()` to restore `par()` after plotting --- R/plot.initial_graph.R | 3 +++ tests/testthat/Rplots.pdf | Bin 9091 -> 9091 bytes 2 files changed, 3 insertions(+) diff --git a/R/plot.initial_graph.R b/R/plot.initial_graph.R index 65d2540..a5c9e93 100644 --- a/R/plot.initial_graph.R +++ b/R/plot.initial_graph.R @@ -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") } diff --git a/tests/testthat/Rplots.pdf b/tests/testthat/Rplots.pdf index f3c1d9508ff034ce2b91c9a09b1a1b46ce6c4d11..a12a2e117c17f98cbc37a36c3942fd97bb37fb37 100644 GIT binary patch delta 48 wcmZp6Z+4$xrfP0zU}$J+U~HzzrSF@c;*waBs-WRwWn^GvVgQ%h7_FfU05+%$B>(^b delta 48 wcmZp6Z+4$xrfOnrU}$V&VPLGurSF@c;*waBs-WRwWn^GvVgQ%h7_FfU05=2-DF6Tf