I can't be sure this will work for you with a reprex
, but I think you need to use transition_reveal
instead of transition_time
for geom_path
/geom_line
.
So you would do:
p <- ggplot(exim1, aes(x = Year, y = value, color = Country)) +
geom_path() +
geom_point() +
facet_grid(Flow ~ Country) +
theme(legend.position = 'none') +
labs(title = 'GDP per Capita, Year: {frame_time}') +
transition_reveal(id = Year, along = Year) +
ease_aes('linear')
animate(p, 100, 10)
You have to pass the Year
column name to both the id
and along
arguments of the function.