-
Notifications
You must be signed in to change notification settings - Fork 2.1k
S7 theme elements #6355
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
S7 theme elements #6355
Conversation
This reverts commit b038e8f.
…6335) * Document vector passing to position_nudge * Put nudge_y into aes call As discussed in tidyverse#6355. * Update documentation * redocument --------- Co-authored-by: Teun van den Brand <[email protected]>
A few things to consider:
|
Merge branch 'main' into S7_elements # Conflicts: # R/geom-label.R # R/guide-.R # R/margins.R # R/theme-elements.R # R/theme.R # man/is_tests.Rd # tests/testthat/test-theme.R
An update:
With that, I think 90% of the worries are gone. Packages that implement their own elements will still need to update, but that should be a manageable number of packages. As such, this PR is ready for review. |
Merge branch 'main' into S7_objects # Conflicts: # R/aes.R # R/plot-construction.R # R/plot.R # R/theme.R
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Merge branch 'main' into S7_elements # Conflicts: # DESCRIPTION
Merge branch 'main' into S7_objects # Conflicts: # DESCRIPTION
Merge branch 'S7_objects' into S7_elements # Conflicts: # NAMESPACE # R/plot-construction.R # R/theme.R # R/zzz.R # man/ggplot_add.Rd # tests/testthat/test-theme.R
Closing, because merged with #6364 |
This PR aims to fix part of #6352.
In essence it converts all S3
element_*()
functions andmargin()
to S7 classes.As it stands, there are some backwards compatibility issues for extensions:
inherits(x, "element_blank")
will no longer work. From 4.3.0 onwards, usinginherits(x, element_blank)
will work, andS7::S7_inherits(x, element_blank)
should work. Alternatively, one could in theory useinherits(x, c("element_blank", "ggplot2::element_blank"))
for backward compatibility, but it'd require a change in the extension.$
,[
or[[
of properties will no longer work and extensions will have to use@
. On ggplot2's end, we can provide methods for the typical generics, but we'd run into Weird S7/S3 interaction RConsortium/S7#390.marquee::element_marquee()
orggtext::element_markdown()
will also have to write their elements as S7 classes. I cannot see a good solution to have this be backwards compatible.