2

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)
Jon Spring
  • 55,165
  • 4
  • 35
  • 53
xhr489
  • 1,957
  • 13
  • 39

1 Answers1

2

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

xhr489
  • 1,957
  • 13
  • 39
  • 1
    I have no clue why that is, but I can confirm that this works... would be great to understand why! – swolf Apr 12 '20 at 08:17