3 Plot everything in ggplot
require(ggplotify)
require(magick)
magick::image_graph(600, 600, res = 96)
img <-invisible(lapply(seq(1, 360, length.out=30), function(angle) {
print(as.ggplot(~barplot(1:5), angle=-angle, scale = 1-angle/360))
}))::dev.off()
grDevices
magick::image_animate(img, fps = 2)
animation <-::image_write(animation, "rotate-scale.gif") magick