yihui / animation

A gallery of animations in statistics and utilities to create animations

Home Page:https://yihui.org/animation/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't make transition_reveal transition_states animate

2Cy1W opened this issue · comments

commented

Hi.
plot works
when add transition_states returns
Error in if (nrow(from) == 0 && nrow(to) == 0 { :
value missing where TRUE/FALSE needed
Warning messages:
1: In rep("raw", length = nrow(from) : first element used of "length.out" argument
2: In rep("raw", length = nrow(to) : first element used of "length.out" argument
3: In rep(NA_integer_, length = nrow(to)) : first element used of "length.out" argument
when instead add transition_reveal() runs but only creates two images with the first year of the plot.

Code reflects all options gathered from different sources. Likely many unnecessary.

library(ggplot2)
library(animation)
library(ggplot2movies)
ani.options(convert = 'C:/PROGRA~1/ImageMagick-7.0.10-Q16/convert.exe')
library(gganimate)
library(sf)
library(dplyr)
library(lubridate)
library(viridis)
library(rust)
library(gifski)
library(transformr)

data <- read.csv("Covid csv 20-4-3", sep = ",", header = TRUE)

read correctly but attached .xls version. format not supported by GitHub.

subdata <- subset(data, countryterritoryCode %in% c("ARG", "CHN", "ITA"))
fecha <- dmy(subdata$dateRep)
ssubdata <- data.frame(fecha, subdata)
p <- ssubdata %>% ggplot(aes(x=fecha, y=cases, group=countryterritoryCode, color=countryterritoryCode)) + geom_line() + geom_point() + scale_color_viridis_d() + transition_reveal(fecha)
transition_states(states = countryterritoryCode)
animate(p, nframes = 20)

Working with R 3.6.3
Updated ggplot2 and gganimate from CRAN today.
Covid csv 20-4-3.xlsx

Would appreciate feedback on how to make it work. Thanks.

@yihui
Could you help the user solve this problem? I will offline for half day. And I don't know why the user uses animation and gganimate at the same time.
@2Cy1W I think you could try to use gganimate to create a beautiful gif picture. You don't need to use those two packages at the same time.

commented

@2Cy1W If you remove the animation package, but still face the same problem, you should open an issue on the gganimate side. I think the problem may not relate to animation package.

Sounds like an issue of gganimate instead, since the error came from a function of gganimate.

commented
commented

Opened issue #383 on thomasp85/gganimate.