Skip to content

Adapt to new theming in ggplot2 #509

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

Merged
merged 3 commits into from
Mar 25, 2025
Merged

Conversation

teunbrand
Copy link
Collaborator

@teunbrand teunbrand commented Jan 23, 2025

This PR aims to fix an issue identified in tidyverse/ggplot2#6287.

Briefly, it incorporates recent changes to ggplot2 themes into gganimate's build method.

As an example (I'm sorry for the default windows GD 😁):

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

p <- ggplot(iris, aes(x = Petal.Width, y = Petal.Length, size = Sepal.Width)) + 
  geom_point() +
  theme_gray(ink = "white", paper = "black")

anim <- p + 
  transition_states(Species,
                    transition_length = 2,
                    state_length = 1)

anim

Created on 2025-01-23 with reprex v2.1.1

@teunbrand
Copy link
Collaborator Author

There is still the matter of labels. ggplot2 no longer precomputes these up-front, but uses ggplot2:::setup_plot_labels() to do this during the build stage. It is not a straightforward function to copy to gganimate as it reaches deep within ggplot2's internals.

@thomasp85 thomasp85 merged commit 41c30cf into thomasp85:main Mar 25, 2025
13 of 14 checks passed
@teunbrand teunbrand deleted the adopt_new_theme branch March 25, 2025 07:01
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