我正在尝试对点和黄土回归线进行动画处理,以便它们在一年中同时出现/显示,但我返回了一个错误,如下所述,带有 reprex。
这将是理想的动画:https://user-images.githubusercontent.com/1775316/49728400-f0ba1b80-fc72-11e8-86c5-71ed84b247db.gif 不幸的是,我发现这个的线程没有附带的代码。
在这里查看我的 reprex 问题:
#Animate points and regression loess line along with dates at the same time
library(MASS) #for phones reprex dataset
phones <- data.frame(phones) #Prepare reprex data
library(ggplot2) #for plotting
library(gganimate) #for animation
#Animation
ggplot(phones, aes(x = year, y = calls)) +
geom_point() + geom_smooth(method = "loess", colour = "orange",
se = FALSE) +
transition_time(year) + shadow_mark() + ease_aes("linear")
Run Code Online (Sandbox Code Playgroud)
这会返回错误:
Error in `$<-.data.frame`(`*tmp*`, "group", value = "") :
replacement has 1 row, data has 0 …Run Code Online (Sandbox Code Playgroud)