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

Feature request - use of expressions in animated labels #439

Closed
tjebo opened this issue Apr 26, 2021 · 1 comment
Closed

Feature request - use of expressions in animated labels #439

tjebo opened this issue Apr 26, 2021 · 1 comment

Comments

@tjebo
Copy link
Contributor

tjebo commented Apr 26, 2021

background - stackoverflow https://stackoverflow.com/questions/67089930/not-getting-the-desired-title-in-gganimate-animated-labels-with-expression

The below is the original plot posted by the OP. No matter what combination I tried with paste, expression, parse, substitute, inside or outside of {...} (thinking this might do the trick kind because of the glue syntax), it either correctly parsed the expression (as in below) or the changing label, but never both.

library(gganimate)
#> Loading required package: ggplot2
ggplot(mtcars, aes(wt, mpg)) + 
  geom_point() + 
  transition_states(hp) +
  labs(title = expression('Hp = {closest_state}' ~ m^2 ~ m^-2))

Created on 2021-04-26 by the reprex package (v2.0.0)

One workaround was suggested with the ggtext package which allows at least sub/supscript, but it fails with any more complex expression.

@tjebo tjebo changed the title Feature request - allow use of expressions in animated labels Feature request - use of expressions in animated labels Apr 26, 2021
@tfjaeger
Copy link

Is this something under development? I'm running into the same limitation. Trying use plotmath functionality combined with reference to gganimate variables like {closest_state}. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants