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

end_pause not working properly #472

Open
NathanHeath27 opened this issue Nov 18, 2022 · 2 comments
Open

end_pause not working properly #472

NathanHeath27 opened this issue Nov 18, 2022 · 2 comments

Comments

@NathanHeath27
Copy link

NathanHeath27 commented Nov 18, 2022

Hey,

I'm having an issue where my end_pause is not working properly at all, it skips back to somewhere in the middle of the animation and freezes on that frame instead of the end frame, as well as clipping off all but 1 labels and the end of the lines.

I am using transition_reveal() on a line chart in ggplot2 / gganimate, my code is as follows...

 data
 
 graph <- ggplot(data = data) +
   geom_line(aes(x = Year , y = Market, color = REGION), linetype = 1,
             size = 1, alpha = 0.75, show.legend = FALSE) +
   geom_text(aes(x = Year , y = Market,
                 label=factor(REGION), group=factor(REGION)),
             hjust = "inward") +
   labs(title = "Market Size by Region",
        y = "Market Size", 
        legend = FALSE) +
   theme_minimal() + 
   ease_aes('linear') +
   theme(plot.margin = unit(c(5,5,5,5), units = "pt")) +
   transition_reveal(Year) +
   enter_grow() +  
   ease_aes('linear') +
   exit_shrink() +
   view_follow(aspect_ratio = 1)
 
 plot(graph)
 
 animate(graph, renderer = gifski_renderer(),
         height = 650, width = 850,
         fps = 10, duration = 25,
         end_pause = 25)

it may be worth noting it also throws up this error...
"geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?"
however this has been present before but not impacted the animation

@thomasp85
Copy link
Owner

I am not able to replicate this in general and your code is not reproducible since data is not available to me. Can you please provide a reprex assuming the issue remains

@DOH-PXC5303
Copy link

DOH-PXC5303 commented Jan 3, 2024

Hi @thomasp85, I ran into a similar issue. Example below. I'm running ggplot2 v3.4.4 and gganimate v1.0.8. Ran into a S.O. thread that suggested 1.0.7 may not have the same issue but I have not tested that.

library(ggplot2)
library(gganimate)

df <- structure(
  list(Submitter = c("AAA", "BBB", "CCC", "DDD", "EEE", 
                     "AAA", "BBB", "CCC", "DDD", "EEE", "AAA", "BBB", "CCC", "DDD", 
                     "AAA", "BBB", "CCC", "DDD"), 
       Submission_Date = structure(c(19389, 
                                     19389, 19389, 19389, 19389, 19358, 19358, 19358, 19358, 19358, 
                                     19327, 19327, 19327, 19327, 19297, 19297, 19297, 19297), class = "Date"), 
       Cumulative_Count = c(275, 97, 23559, 3300, 878, 263, 97, 
                            23081, 3271, 0, 236, 97, 22727, 3212, 230, 97, 22288, 3206
       )), 
  row.names = c(NA, -18L), 
  class = c("tbl_df", "tbl", "data.frame"))

anim <- ggplot(df,
               aes(x = Submission_Date, y = Cumulative_Count, color=Submitter)) +
  geom_point() +
  geom_line()+
  transition_reveal(Submission_Date)

animate(anim,
        nframes = 120,
        end_pause = 100)
#> `geom_line()`: Each group consists of only one observation.
#> ℹ Do you need to adjust the group aesthetic?
#> `geom_line()`: Each group consists of only one observation.
#> ℹ Do you need to adjust the group aesthetic?

Edit: Ran using gganimate v1.0.7 and found a slightly altered output with lines and points. Output does not have the disappearing line at end pause issue.
example

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