【发布时间】:2019-01-30 20:40:17
【问题描述】:
我正在尝试使用下面提到的数据为 geom_line 图制作动画:
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
我的代码
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)
【问题讨论】:
-
我不知道您遇到了什么错误,但似乎命令
y = newfile$Total.Return可能是个问题,因为该变量被简单地称为Return。 -
@mmyoung77 我得到 ggproto 对象错误变量不是问题