diff --git a/DESCRIPTION b/DESCRIPTION index fab822c3..4d6e7666 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -54,7 +54,7 @@ Suggests: knitr Config/Needs/website: etiennebacher/altdoc, future.apply Encoding: UTF-8 -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.3 URL: https://grantmcdermott.com/tinyplot/ BugReports: https://github.com/grantmcdermott/tinyplot/issues Roxygen: list(markdown = TRUE) diff --git a/NEWS.md b/NEWS.md index a0c3eaea..699a17e4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -40,6 +40,8 @@ where the formatting is also better._ plot type internally coerces it to factor (e.g., `"boxplot"`) - `type_text()` can now also deal with factor `x`/`y` variables by converting them to numeric which helps to add text to barplots etc. (#470 @zeileis) +- Fix bug where sourced (non-interactive) scripts with `tinytheme()` calls were + not inheriting the correct LHS margin spacing. (#475 @grantmcdermott) ### Internals diff --git a/R/facet.R b/R/facet.R index 7f580f01..861853e2 100644 --- a/R/facet.R +++ b/R/facet.R @@ -33,7 +33,8 @@ draw_facet_window = function( has_legend, type, x, xmax, xmin, - y, ymax, ymin + y, ymax, ymin, + dynmar = NULL ) { # if add is TRUE, just return inputs without any calculations @@ -53,7 +54,8 @@ draw_facet_window = function( } ## dynamic margins flag - dynmar = isTRUE(.tpar[["dynmar"]]) + if (is.null(dynmar)) dynmar = get_tpar("dynmar") + dynmar = isTRUE(dynmar) ## optionally allow to modify the style of axis interval calculation if (!is.null(xaxs)) par(xaxs = xaxs) diff --git a/R/tinyplot.R b/R/tinyplot.R index 83a6dc31..522fb5d6 100644 --- a/R/tinyplot.R +++ b/R/tinyplot.R @@ -1229,7 +1229,8 @@ tinyplot.default = function( has_legend = has_legend, type = type, x = x, xmax = xmax, xmin = xmin, - y = y, ymax = ymax, ymin = ymin + y = y, ymax = ymax, ymin = ymin, + dynmar = dynmar ), list = list( add = add, @@ -1252,7 +1253,8 @@ tinyplot.default = function( has_legend = has_legend, type = type, x = datapoints$x, xmax = datapoints$xmax, xmin = datapoints$xmin, - y = datapoints$y, ymax = datapoints$ymax, ymin = datapoints$ymin + y = datapoints$y, ymax = datapoints$ymax, ymin = datapoints$ymin, + dynmar = get_tpar("dynmar") # https://github.com/grantmcdermott/tinyplot/issues/474 ), getNamespace("tinyplot") ) diff --git a/R/zzz.R b/R/zzz.R index ddd76daa..942e7082 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -18,6 +18,7 @@ "cex_fct_adj", "dots", "draw", + "dynmar", "facet_bg", "facet_border", "facet_col", diff --git a/man/facet.Rd b/man/facet.Rd index 5028a35c..4ee9002e 100644 --- a/man/facet.Rd +++ b/man/facet.Rd @@ -53,7 +53,8 @@ draw_facet_window( xmin, y, ymax, - ymin + ymin, + dynmar = NULL ) facet_layout(facet, add = FALSE, facet.args = list())