-
Notifications
You must be signed in to change notification settings - Fork 11
Compatibility with ggplot2 4.0.0 #156
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
Conversation
Thanks @teunbrand! Are there any materials that would serve as a good place to get up to speed on these recent changes? |
|
There isn't any material about this out yet, but we plan to make a blog post about it. As mentioned, default aesthetics are now often expressions with the library(ggplot2)
GeomPoint$default_aes
#> Aesthetic mapping:
#> * `shape` -> `from_theme(pointshape)`
#> * `colour` -> `from_theme(ink)`
#> * `size` -> `from_theme(pointsize)`
#> * `fill` -> NA
#> * `alpha` -> NA
#> * `stroke` -> `from_theme(borderwidth)`Mirroring these layer defaults is a The ink/paper distinction is more important for setting full themes, which populates the elements including the plot + theme_gray(ink = "limegreen", paper = "grey30")In addition, we can set default palettes from the theme like so: plot + aes(colour = cty) +
theme(palette.colour.continuous = c("limegreen", "grey30"))Created on 2025-01-31 with reprex v2.1.1 You can find all palettes that ggplot2 populates here: https://github.com/tidyverse/ggplot2/blob/1bfb3c9b26a046a878d97a15cccf108973a8150a/R/theme-elements.R#L786-L799 |
|
This PR should now also make thematic compatible with the S7 changes in ggplot2. I recommend reviewing the visual tests too, as the following mentioned above still holds:
Code can be tested with the development version of ggplot2 by installing it as follows: # install.packages("pak")
pak::pak("tidyverse/ggplot2")We aim to release the new ggplot2 version in about 2 weeks, and hope you can submit a fix to CRAN around that time. Hopefully this will inform you in a timely manner. Best wishes, |
* Use dev evaluate to fix README rendering bug * Avoid Remotes field * `devtools::build_readme()` (GitHub Actions) --------- Co-authored-by: cpsievert <[email protected]>
* Avoid using deprecated context() * Try setting testthat edition 3 * Skip on CI and add a note about why
This reverts commit fd3735b.
|
Thank you @teunbrand (and sorry you've had to navigate multiple of my gnarly ggplot2 hacks), it is much appreciated!! |
|
Thanks for working together to tackle problems that sort of are my fault! |



This PR aims to fix tidyverse/ggplot2#6317.
Briefly, the
default_aesfields have changed to more often include expressions that are to be evaluated instead of fixed values. This causes a problem for thematic in extracting these defaults, as thematic expects the fixed values.This PR uses ggplot2's new getter to resolve this information, which makes thematic compatible again with the impending ggplot2 version.
In addition, I've seen some visual changes that appear to be due to a miscalculation of the
axis.ticks.lengthfamily of theme settings. I haven't familiarised myself too much with how thematic derives these, but it might be worth reviewing at some point.As an aside, ggplot2 has revamped how defaults are determined, which are now mostly determined via the theme. Partially this overlaps with thematic goals, so I think there might be an opportunity to leverage ggplot2's new theme settings to reduce the effort thematic has to do.
We plan to release the new ggplot2 version in May 2025, so I'd be great if we didn't break thematic at that point.