xhr489
xhr489

Reputation: 2309

gganimate does not show anything

I have installed the transformr and gifski packages because of my messages. How come the following code does not work? I get lots of messages with:

geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?

library(gapminder)
library(gganimate)
library(gifski)
library(transformr)
library(dplyr)   # For %>%  and  filter  and  %in%
library(ggplot2) 

gapminder %>% 
  filter(country %in% c("Afghanistan", "United States")) %>% 
  ggplot() +
  geom_line(aes(year, pop, group=country)) + 
  transition_time(year)

Upvotes: 2

Views: 497

Answers (1)

xhr489
xhr489

Reputation: 2309

I have solved the problem. I need to use transition_reveal instead of transition_time.

Upvotes: 2

Related Questions