Skip to content
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

Adapt to new theming in ggplot2 #509

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

teunbrand
Copy link
Contributor

@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
Contributor 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.

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.

1 participant