Closed teunbrand closed 4 months ago
This PR aims to fix #5901.
Briefly, when after_stat() or after_scale() produce aesthetics of the wrong length, a warning is thrown that the function could not be applied.
after_stat()
after_scale()
The reprex from the issue now renders with a warning:
devtools::load_all("~/packages/ggplot2") #> ℹ Loading ggplot2 ggplot(mpg[15:16, ], aes(displ, hwy)) + geom_point( aes(colour = after_scale(c("red", "green", "blue"))) ) #> Warning: Failed to apply `after_scale()` for the following aesthetic: colour.
Created on 2024-05-22 with reprex v2.1.0
I have an alternate agenda with this PR. Moving this check into Geom$use_defaults() frees us from having to do so in the legend code, allowing a simplification I ultimately need for #5833.
Geom$use_defaults()
Thanks for the review Thomas!
This PR aims to fix #5901.
Briefly, when
after_stat()
orafter_scale()
produce aesthetics of the wrong length, a warning is thrown that the function could not be applied.The reprex from the issue now renders with a warning:
Created on 2024-05-22 with reprex v2.1.0
I have an alternate agenda with this PR. Moving this check into
Geom$use_defaults()
frees us from having to do so in the legend code, allowing a simplification I ultimately need for #5833.