Skip to content

Commit cfbd44d

Browse files
Correct set/get_saved_par order (#486)
* save current pars before restoring old ones * add test
1 parent 4dc72ee commit cfbd44d

File tree

3 files changed

+359
-9
lines changed

3 files changed

+359
-9
lines changed

R/tinyplot.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -659,15 +659,6 @@ tinyplot.default = function(
659659
}
660660
}
661661

662-
# catch for adding to existing facet plot
663-
if (!is.null(facet) && add) {
664-
recordGraphics(
665-
par(get_saved_par(when = "after")),
666-
list = list(),
667-
env = getNamespace('tinyplot')
668-
)
669-
}
670-
671662
# Save current graphical parameters
672663
opar = par(no.readonly = TRUE)
673664
if (restore.par || !is.null(facet)) {
@@ -678,6 +669,15 @@ tinyplot.default = function(
678669
}
679670
set_saved_par(when = "before", opar)
680671

672+
# Catch for adding to existing facet plot
673+
if (!is.null(facet) && add) {
674+
recordGraphics(
675+
par(get_saved_par(when = "after")),
676+
list = list(),
677+
env = getNamespace('tinyplot')
678+
)
679+
}
680+
681681
# Ephemeral theme
682682
if (!is.null(theme)) {
683683
# browser()

0 commit comments

Comments
 (0)