Repository navigation
Rename with_pattern()'s group to pool and allow TRUE / FALSE - #137
Merged
Merged
Conversation
…`FALSE`
ggplot2 puts a `group` column in every layer's data, so a whole data row
spliced into `with_pattern()` (as {ggpattern} needs to pass the plain
aesthetics on to custom patterns) always collided with `group`. The
word also meant both ggplot2's grouping and grid's `group` argument of
`grid::pattern()`, a single logical. `with_pattern()` is unreleased, so
the argument is now `pool`, and a spliced `group` is an ordinary pattern
parameter again (as `params$group` was on master for ggpattern).
`pool` is `FALSE` by default (each area its own pattern), `TRUE` (all
the areas of each grob share one pattern, like grid's `group = TRUE`
per grob, e.g. one image spanning a rect grob's rectangles), or one
non-logical label per area (areas with the same label share one pattern
whether or not they touch, and must be areas of the same grob). A
logical vector of labels or an `NA` is an error.
`patternGrob()`'s `default.units` and `draw` are also reserved names in
`with_pattern()`'s dots, since they were silently consumed by those
arguments whatever the `prefix`.
The factor conversion added with the dynamic dots is dropped: since R
4.0.0 `data.frame()` doesn't make factors by default and ggplot2's
layer data has none besides `PANEL`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Renames
with_pattern()'sgroupargument topool, and lets it beTRUEorFALSEas well as labels.Why the rename. ggplot2 adds a
groupcolumn to every layer's data. When{ggpattern}splices a whole data row withprefix = ""so that custom patterns get the plain aesthetics, as on ggpattern's master, that column always collided with our argument. The word also already means something else in grid:grid::pattern()'sgroupis a single logical.with_pattern()is unreleased, so this is the cheap moment to change it. After the rename, a splicedgroupis an ordinary pattern parameter again.What
poolaccepts:FALSE, the default: each area gets its own pattern.TRUE: all the areas of each grob share one pattern. This is grid'sgroup = TRUEapplied per grob, e.g. one image spanning all the rectangles of arectGrob().A logical vector of labels or an
NAis an error. Per-pool parameters have one value per grob forTRUE, or one per label in the order ofunique(pool).Also:
patternGrob()'sdefault.unitsanddraware reserved names inwith_pattern()'s dots. Before, those arguments silently consumed them whatever theprefix.with_pattern()takes itspatternand parameters as dynamic dots #136 is dropped. Since R 4.0.0data.frame()doesn't make factors by default, and ggplot2's layer data has none exceptPANEL.🤖 Generated with Claude Code