thomasp85/gganimate

`view_step_manual()` inserts final frame at start of animation

bbcuffer opened this issue · 0 comments

I think the combination of wrap = FALSE and pause_first = TRUE creates an issue with the first frame of the animation.

Has also happened using view_zoom_manual()

The animation here is supposed to start with x-limits of 1-7 and then zoom in to the top section of the x-axis (x-limits of 4-7).

ggplot(iris, aes(Petal.Length, Petal.Width, colour = Species)) +
       geom_point() +
       view_step_manual(wrap = FALSE,
                        pause_first = TRUE, 
                        xmin = c(1, 4),
                        xmax = c(7, 7),
                        ymin = 0,
                        ymax = 2.5
                        )

I've attached the first frame of the animation: limits are 4-7.

gganim_plot0001

And md5sums below show first frame is identical to final, rather than the the subsequent frames.

r$> md5s <- frame_vars() |> dplyr::pull(frame_source) |> purrr::map_chr(tools::md5sum)

r$> head(md5s)
[1] "8641919fb31b0bc4fe0b76b47210ae61" "d696c68c1add19d8e185beaaed3eff32" "d696c68c1add19d8e185beaaed3eff32"
[4] "d696c68c1add19d8e185beaaed3eff32" "d696c68c1add19d8e185beaaed3eff32" "d696c68c1add19d8e185beaaed3eff32"

r$> tail(md5s)
[1] "8641919fb31b0bc4fe0b76b47210ae61" "8641919fb31b0bc4fe0b76b47210ae61" "8641919fb31b0bc4fe0b76b47210ae61"
[4] "8641919fb31b0bc4fe0b76b47210ae61" "8641919fb31b0bc4fe0b76b47210ae61" "8641919fb31b0bc4fe0b76b47210ae61"