ggplot 中的时间序列使用 geom_line
time-series in ggplot using geom_line
我对 gganimate 比较陌生,我正在尝试在 R studio 上创建一个简单的多项式时间序列图。
x <- 1:100
f <- function (x){
return(-(x)^2)
}
df <- data.frame(x, y= -(x)^2)
ggplot(df, aes(x, y)) +
geom_line() +
stat_function(fun=f) +
transition_states(x, transition_length = 1, state_length = 2 )
我的错误显示:
" Error in transform_path(all_frames, next_state, ease, params$transition_length[i], :
transformr is required to tween paths and lines "
我想知道 transition_state() 中是否缺少某些内容?它作为静态图看起来很好,但我想让它成为一个时间序列图。
感谢任何建议/帮助!!谢谢 !
请参阅 https://github.com/thomasp85/gganimate/issues/190 and https://community.rstudio.com/t/error-dependency-transformr-is-not-available-for-package-gganimate/11134:需要包 transformr
才能将 transform_path
应用到 geom_line()
devtools::install_github("thomasp85/transformr")
我对 gganimate 比较陌生,我正在尝试在 R studio 上创建一个简单的多项式时间序列图。
x <- 1:100
f <- function (x){
return(-(x)^2)
}
df <- data.frame(x, y= -(x)^2)
ggplot(df, aes(x, y)) +
geom_line() +
stat_function(fun=f) +
transition_states(x, transition_length = 1, state_length = 2 )
我的错误显示:
" Error in transform_path(all_frames, next_state, ease, params$transition_length[i], :
transformr is required to tween paths and lines "
我想知道 transition_state() 中是否缺少某些内容?它作为静态图看起来很好,但我想让它成为一个时间序列图。
感谢任何建议/帮助!!谢谢 !
请参阅 https://github.com/thomasp85/gganimate/issues/190 and https://community.rstudio.com/t/error-dependency-transformr-is-not-available-for-package-gganimate/11134:需要包 transformr
才能将 transform_path
应用到 geom_line()
devtools::install_github("thomasp85/transformr")