Using gganimate to craft animated ggplots

Animations are wonderful to attract attention to the information you want to display; they can make plots funnier, replace facets, and are very good matches to social media publications. Package gganimate makes it very simple to animate your ggplot. It takes you only to set a variable as frame aesthetic and then input your ggplot into gganimate() function create an animated version.

Animations created this way are very gif-like; in matter of fact, you can save you plot as .gif file. This recipe's goal is to show the general way plots made with ggplot2 can be animated using gganimate. All this will be done under the Titanic data set framework. Let's create an animation that shows how many women and ...

Get R Data Visualization Recipes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.