time-series in ggplot using geom_line
Asked Answered
W

1

5

I'm relatively new to gganimate and I'm trying to create a simple polynomial time-series graph on 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 )

My error shows:

" Error in transform_path(all_frames, next_state, ease, params$transition_length[i],  : 
  transformr is required to tween paths and lines "

I'm wondering if there's something missing in transition_state() ? It appears fine as a static graph but I'd like to make it a time-series graph.

Appreciate any advice / help!! Thank you !

Wildebeest answered 22/11, 2018 at 0:1 Comment(1)
Where does transition_states come from? Please edit the question with a call to library(pkgname) loading the package where transition_states is.Gauvin
H
7

See https://github.com/thomasp85/gganimate/issues/190 and https://community.rstudio.com/t/error-dependency-transformr-is-not-available-for-package-gganimate/11134: the package transformr is required to apply transform_path to geom_line() devtools::install_github("thomasp85/transformr")

Harman answered 22/11, 2018 at 5:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.