Skip to content

Conversation

teunbrand
Copy link
Collaborator

This PR to the RC branch aims to fix #5593.

Briefly, instead of coercing a plain pattern to a list in Geom$use_defaults(), it does so in the layer() function.
This has two consequences:

  1. Other internals, like GuideLegend$get_layer_key() or Geom$use_defaults() don't have to deal with plain patterns.
  2. If a pattern is provided to another aesthetic than 'fill', it is also coerced to a list, opening up 'fill'-variant aesthetics for patterns. For example, a package might use a 'fill_box' aesthetic for a geom.

Reprex from #5593:

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

grad <- grid::linearGradient(pal_viridis()(10))

ggplot(mpg, aes(factor(cyl), colour = "fixed")) +
  geom_bar(fill = grad)

Created on 2023-12-18 with reprex v2.0.2

@teunbrand teunbrand added this to the ggplot2 3.5.0 milestone Dec 18, 2023
Copy link
Member

@thomasp85 thomasp85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@teunbrand
Copy link
Collaborator Author

Thanks!

@teunbrand teunbrand merged commit fe9d5bd into tidyverse:rc/3.5.0 Dec 18, 2023
@teunbrand teunbrand deleted the pattern_ingestion branch December 18, 2023 14:37
thomasp85 pushed a commit that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants