I m trying to animate geom_line graph with below mentioned data :
quarter Total.Return Investor
2009-03-30 4 A
2009-03-30 5 B
2009-06-30 7 A
2009-06-30 10 B
2009-09-30 12 A
2009-09-30 11 B
2009-12-30 25 A
2009-12-30 35 B
2010-03-30 65 A
2010-03-30 65 B
My code
library(ggplot2)
library(gganimate)
ggplot(newfile, aes(Quarter, Total.Return, color = Investor, label = Investor, group = Investor)) +
geom_line()+
scale_x_date(breaks = newfile$Quarter)+
theme(axis.text.x = element_text(angle = 90, hjust = 1))
# scale_x_date(labels = date_format("%m/%d/%Y"))+
transition_time(Quarter)