2

I would like to add a regression line to my gganimate plot. Without the regression the line the gganimate plot works as expected, and when I add the the geom_smooth command to the regular plot it works fine. I only receive an error when I try to add the regression line to the gganimate plot.

g <- ggplot(pdata, aes(x = ole, y = rsv)) + 
        geom_point(aes(color = region)) + 
        geom_smooth(aes(group = region, color = region), se = FALSE)

anim <- g + transition_states(region, transition_length = 3, state_length = 5) 
anim

I receive the error message:

 geom_smooth()` using method = 'loess' and formula 'y ~ x'
`geom_smooth()` using method = 'loess' and formula 'y ~ x'
Error in transform_path(all_frames, next_state, ease, params$transition_length[i],  : 
  transformr is required to tween paths and lines
Dave2e
  • 22,192
  • 18
  • 42
  • 50
Liam Haller
  • 182
  • 10

0 Answers0