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

Can shadow_mark be made to work with transition_manual? #298

Open
AdrianAllen1977 opened this issue Feb 25, 2019 · 3 comments
Open

Can shadow_mark be made to work with transition_manual? #298

AdrianAllen1977 opened this issue Feb 25, 2019 · 3 comments

Comments

@AdrianAllen1977
Copy link

Trying to map some epi data (disease location) in which it would be good to see all previously mapped points in relation to new points. Shadow_mark doesn't seem to be working for transition_manual.

Thanks

@lgaborini
Copy link

lgaborini commented Apr 18, 2023

Any updates? It could be a workaround to #481:

p <- mtcars |> 
   ggplot(aes(wt, mpg)) +
   geom_point(
      aes(
         color = gear
      ),
      size = 2
   ) +
   transition_manual(
      frames = gear
   ) +
   shadow_mark(
      past = TRUE,
      future = TRUE,
      color = "gray20"
   ) +
   labs(
      title = "Frame {frame}/{nframes}"
   )

n_states <- length(unique(mtcars$gear))
n_states

a <- animate(
   plot = p,
   nframes = n_states,
   fps = 1,
   detail = 1,
   start_pause = 0,
   end_pause = 0,
   rewind = FALSE
)

a

This is the error:

a <- animate(
   plot = p,
   nframes = n_states,
   fps = 1,
   detail = 1,
   start_pause = 0,
   end_pause = 0,
   rewind = FALSE
)
#> Error in `[[<-.data.frame`(`*tmp*`, i, value = "gray20"): replacement has 1 row, data has 0

Created on 2023-04-18 with reprex v2.0.2

@julianselke
Copy link

In the current version of gganimate (1.0.8) there is no need to use shadow_mark() to keep all previously mapped data visible. Just add the argument cumulative = TRUE to the transition_manual() call.

@AdrianAllen1977
Copy link
Author

AdrianAllen1977 commented Sep 22, 2023 via email

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

4 participants