-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate scale definition of position aesthetics #5640
base: main
Are you sure you want to change the base?
Conversation
Are there any plans to put the solution regarding this issue into the next release? It's really annoying that vertical lines plotted far outside the date limits are not considered. |
I totally agree with you there. We want the next release to be a low-risk hotfix where we mostly fix mistakes from 3.5.0 and not put in something disruptive. |
yes, this will be postponed |
After a lot of digging I found that the addition of |
Bunch of revue-check failures. I'm pretty sure that most or all are unrelated to this but please sift through them |
I can see the irony in some of the revdep failures. For example this now correctly throws the error that it will not accept any non-dates. devtools::load_all("~/packages/ggplot2/")
#> ℹ Loading ggplot2
# Analogous to current workarounds
ggplot(economics, aes(date, unemploy)) +
geom_line() +
geom_vline(xintercept = as.numeric(as.Date("1983-01-31")))
#> Error in `transformation$transform()` at ggplot2/R/scale-.R:628:3:
#> ! `transform_date()` works with objects of class <Date> only Whereas now the solution is to simply drop the ggplot(economics, aes(date, unemploy)) +
geom_line() +
geom_vline(xintercept = as.Date("1983-01-31")) Created on 2024-05-21 with reprex v2.1.0 |
This PR aims to fix #3342 and fix #4966.
Briefly, all position scales now use the definitions of x- and y-aesthetics from the
gglobal_global
environment.This ensures that rarer position aesthetics, like
xintercept
, contribute to the scale limits and are transformed by the scale.I have been forewarned that this might lead to unexpected issues, but I don't foresee any at the moment. It might lead to some visual changes, but I'd argue they might be intended.
Reprex from #4966:
Created on 2024-01-12 with reprex v2.0.2