gganimate

Possible to animate polygon fill using gganimate in R?

不打扰是莪最后的温柔 提交于 2021-02-18 17:04:21
问题 I have county level data recording the year an invasive insect pest was first detected in that county between 2002 and 2018. I created a map using ggplot2 and the maps package that fills the county polygons with a color according to the year the pest was detected. **Is there a way to use the gganimate package to animate this map with the first frame filling in only polygons with a detection date of 2002, the second frame filling polygons with a detection date of 2003 or earlier (so 2002 and

gganimate: data present only in some frames

主宰稳场 提交于 2021-02-11 17:57:42
问题 I have a problem animating plots where data in some layers in present only in some of the frames. In the example below, I have a moving point that can be nicely animated along 9 frames. However, when I add another layer with a point present only in some of the frames, I get the following error: Error: time data must be the same class in all layers Example : require(data.table) require(ggplot2) require(gganimate) # 9 points along x=y; present at every time point dtP1 = data.table(x = 1:9, y =

gganimate: data present only in some frames

我的梦境 提交于 2021-02-11 17:57:20
问题 I have a problem animating plots where data in some layers in present only in some of the frames. In the example below, I have a moving point that can be nicely animated along 9 frames. However, when I add another layer with a point present only in some of the frames, I get the following error: Error: time data must be the same class in all layers Example : require(data.table) require(ggplot2) require(gganimate) # 9 points along x=y; present at every time point dtP1 = data.table(x = 1:9, y =

gganimate returns .png files, but no animated object

微笑、不失礼 提交于 2021-02-07 14:41:48
问题 I am trying to create an animation to show students how to represent data with animations. Running the below code library(ggplot) library(gganimate) library(carData) anim <- ggplot(mtcars, aes(mpg, disp)) + transition_states(gear, transition_length = 2, state_length = 1) + enter_fade() + exit_fade() animate(anim) I was expecting an animation on a preview window and the creation of a gif image. Conversely, what I am getting is 100 .png files in the working directory, but nothing else. The

gganimate returns .png files, but no animated object

浪尽此生 提交于 2021-02-07 14:41:14
问题 I am trying to create an animation to show students how to represent data with animations. Running the below code library(ggplot) library(gganimate) library(carData) anim <- ggplot(mtcars, aes(mpg, disp)) + transition_states(gear, transition_length = 2, state_length = 1) + enter_fade() + exit_fade() animate(anim) I was expecting an animation on a preview window and the creation of a gif image. Conversely, what I am getting is 100 .png files in the working directory, but nothing else. The

gganimate returns .png files, but no animated object

那年仲夏 提交于 2021-02-07 14:39:29
问题 I am trying to create an animation to show students how to represent data with animations. Running the below code library(ggplot) library(gganimate) library(carData) anim <- ggplot(mtcars, aes(mpg, disp)) + transition_states(gear, transition_length = 2, state_length = 1) + enter_fade() + exit_fade() animate(anim) I was expecting an animation on a preview window and the creation of a gif image. Conversely, what I am getting is 100 .png files in the working directory, but nothing else. The

Error in animate.default() : animation of gg objects not supported

偶尔善良 提交于 2021-01-29 12:01:20
问题 Getting error message Error in animate.default() : animation of gg objects not supported when running the following (from tutorial here) library(ggplot2) library(gganimate) library(gapminder) theme_set(theme_bw()) # pre-set the bw theme. g <- ggplot(gapminder, aes(gdpPercap, lifeExp, size = pop, frame = year)) + geom_point() + geom_smooth(aes(group = year), method = "lm", show.legend = FALSE) + facet_wrap(~continent, scales = "free") + scale_x_log10() # convert to log scale animate(g,

Using gganimate and getting all kind of errors

前提是你 提交于 2021-01-28 18:20:40
问题 I am trying to create an animation using gganimate: library(ggplot2) library(ggthemes) library(gifski) library(gganimate) load("covid-19-es.Rda") casos <- ggplot(data,aes(x=Fecha))+geom_point(aes(y=casos,color="Casos"))+geom_point(aes(y=salidas,color="Salidas"))+theme_tufte()+transition_states(Fecha,transition_length=2,state_length=1)+labs(title='Day: {frame_time}') animate(casos, duration = 5, fps = 20, width =800, height = 600, renderer=gifski_renderer()) anim_save("casos.png") The data

Issue with gganimate and (sometimes) empty facets

Deadly 提交于 2021-01-24 11:10:14
问题 I'm observing some behavior in gganimate that I cannot explain, and I would like to understand what I am doing wrong (or whether it is a bug). For example, here is a very simple dataset and a plot of it: library(dplyr) # dplyr_0.7.8 library(tidyr) # tidyr_0.8.2 crossing(p = 1:2, t = seq(0, 1, len = 30), s = c(0, .5)) %>% mutate(x = t, y = t^p) %>% filter(t > s) -> Z library(ggplot2) # ggplot2_3.1.0 Z %>% ggplot(aes(x,y)) + facet_wrap(~s) + geom_point() As expected the second facet (s=0.5)

Issue with gganimate and (sometimes) empty facets

一个人想着一个人 提交于 2021-01-24 11:07:44
问题 I'm observing some behavior in gganimate that I cannot explain, and I would like to understand what I am doing wrong (or whether it is a bug). For example, here is a very simple dataset and a plot of it: library(dplyr) # dplyr_0.7.8 library(tidyr) # tidyr_0.8.2 crossing(p = 1:2, t = seq(0, 1, len = 30), s = c(0, .5)) %>% mutate(x = t, y = t^p) %>% filter(t > s) -> Z library(ggplot2) # ggplot2_3.1.0 Z %>% ggplot(aes(x,y)) + facet_wrap(~s) + geom_point() As expected the second facet (s=0.5)