This post describes how to build a basic count down
.gif
animation. It uses R
to make 10
images, and Image Magick to concatenated them in a
.gif
.
This is probably the most basic animated plot (.gif
format) you can do with R
and Image Magick.
R
gif
Of course, Image Magick must be installed on your computer. See here to install it.
Note: : This example has been found on Mark Heckmann’s R you ready website.
# Build 10 images -> save them at .png format
png(file="example%02d.png", width=480, height=480)
par(bg="grey")
for (i in c(10:1, "G0!")){
plot.new()
text(.5, .5, i, cex = 6 )
}
dev.off()
# Use image magick
system("convert -delay 80 *.png animated_count_down.gif")
# Remove png files
file.remove(list.files(pattern=".png"))
👋 After crafting hundreds of R charts over 12 years, I've distilled my top 10 tips and tricks. Receive them via email! One insight per day for the next 10 days! 🔥