diff --git a/.gitignore b/.gitignore index 3120fd1c..792f123c 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,5 @@ SCRATCH _quarto /.quarto/ + +Rplots.pdf \ No newline at end of file diff --git a/NEWS.md b/NEWS.md index 3598ee08..79f02af2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,7 +8,12 @@ where the formatting is also better._ ### Breaking change -- Internal settings and parameters are now stored in an environment called `settings`, which can be accessed and modified by type-specific functions. This may require changes to users' custom type functions that previously accessed settings as passed arguments. This change was necessary to improve the modularity and maintainability of the codebase, and to add flexibility. (#473 @vincentarelbundock and @grantmcdermott) +- Internal settings and parameters are now stored in an environment called + `settings`, which can be accessed and modified by type-specific functions. + This may require changes to users' custom type functions that previously + accessed settings as passed arguments. This change was necessary to improve + the modularity and maintainability of the codebase, and also to add downstream + flexibility. (#473 @vincentarelbundock and @grantmcdermott) ### New features @@ -28,6 +33,8 @@ where the formatting is also better._ `tinyplot_add()` is now more robust so that it is compatible with `do.call()` again (reported by @FlorianSchwendinger). This is achieved by inspecting the functions called rather than just their names. (#504 @zeileis) +- Legend labels are now correct if `by` is logical. Thanks to @@TCornulier for + the report. (#512 @grantmcdermott) ### Documentation diff --git a/R/sanitize_datapoints.R b/R/sanitize_datapoints.R index c8f0e425..c3d0873c 100644 --- a/R/sanitize_datapoints.R +++ b/R/sanitize_datapoints.R @@ -1,10 +1,21 @@ sanitize_datapoints = function(settings) { # potentially useful variables - env2env(settings, environment(), c("x", "xmin", "xmax", "xaxt", "y", "ymin", "ymax", "ygroup", "facet", "null_by", "by", "type")) + env2env( + settings, + environment(), + c( + "x", "xmin", "xmax", "xaxt", + "y", "ymin", "ymax", "ygroup", + "facet", "null_by", "by", "type" + ) + ) - ## coerce character variables to factors + ## coerce character and logical variables to factors + ## (aside: we won't risk converting x and y logicals to factors b/c it can + ## mess up types that rely on predict underneath the hood, e.g type_lm) if (!is.null(x) && is.character(x)) x = factor(x) if (!is.null(y) && is.character(y)) y = factor(y) + if (!null_by && is.logical(by)) by = factor(by) if (is.null(x)) { ## Special catch for rect and segment plots without a specified y-var