我有一个ggConvexHull绘图,我想用gganimate进行动画处理。
情节代码如下:
p<-ggplot(tchart, aes(x = beatenLengths,y = OffRail, label=pgm)) +
geom_point() +
geom_label(aes(label=pgm), size = 2.0) +
geom_convexhull(alpha = 0.1, fill = "blue") +
# facet_wrap(~ Sixteenth, ncol=4) +
ggtitle(title) +
theme_fivethirtyeight()
p + transition_time(Sixteenth) +
labs(title = "Sixteenth:{frame_time}")
从注释的代码行中您可以看到,该图本来是一个facet_grid的,但是我认为动画化从facet到facet的过渡可能很有趣。不幸的是,当我运行代码时,出现以下错误:
Error in transform_polygon(all_frames, ease, nframes[i], : transformr is required to tween polygon calls: <Anonymous> ...lapply -> FUN -> <Anonymous> -> f -> transform_polygon