yihui / animation

A gallery of animations in statistics and utilities to create animations
https://yihui.org/animation/
206 stars 60 forks source link

Can't make transition_reveal transition_states animate #124

Closed 2Cy1W closed 4 years ago

2Cy1W commented 4 years ago

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(NAinteger, 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.

yulijia commented 4 years ago

@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.

2Cy1W commented 4 years ago

Thanks. Glad to help. No specific reason to use animation and gganimate. Tried again leaving only gganimate and problem persists. Will also offline for the night but will be glad to help.

El jue., 9 abr. 2020 a las 21:39, Lijia Yu (notifications@github.com) escribió:

@yihui https://github.com/yihui Could you help the author solve this problem? I will offline for half day. And I don't know why the author uses animation and gganimate at the same time. @2Cy1W https://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yihui/animation/issues/124#issuecomment-611818659, or unsubscribe https://github.com/notifications/unsubscribe-auth/APD5SBOKZPH3PCCSMANSMVDRLZTCNANCNFSM4MFC4CSA .

yulijia commented 4 years ago

@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.

yihui commented 4 years ago

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

2Cy1W commented 4 years ago

Seems you are ponting in the right direction. I ran the code with animation library and without gganimate and it can´t find the transition functions. I will repost the thread on gganimate. Apologies for the mistake and Thanks.

El vie., 10 abr. 2020 a las 0:40, Yihui Xie (notifications@github.com) escribió:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/yihui/animation/issues/124#issuecomment-611862752, or unsubscribe https://github.com/notifications/unsubscribe-auth/APD5SBIFZMWNPMSXFOE64G3RL2IKRANCNFSM4MFC4CSA .

http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Libre de virus. www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

2Cy1W commented 4 years ago

Opened issue #383 on thomasp85/gganimate.