Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ SCRATCH
_quarto

/.quarto/

Rplots.pdf
9 changes: 8 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
15 changes: 13 additions & 2 deletions R/sanitize_datapoints.R
Original file line number Diff line number Diff line change
@@ -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
Expand Down