{"id":8487,"date":"2019-01-25T00:18:09","date_gmt":"2019-01-24T22:18:09","guid":{"rendered":"https:\/\/www.datanovia.com\/en\/?p=8487"},"modified":"2019-12-25T10:48:55","modified_gmt":"2019-12-25T08:48:55","slug":"gganimate-how-to-create-plots-with-beautiful-animation-in-r","status":"publish","type":"post","link":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/","title":{"rendered":"gganimate: How to Create Plots with Beautiful Animation in R"},"content":{"rendered":"<div id=\"rdoc\">\n<p>This article describes how to create animation in R using the <strong>gganimate<\/strong> R package.<\/p>\n<p>gganimate is an extension of the ggplot2 package for creating animated ggplots. It provides a range of new functionality that can be added to the plot object in order to customize how it should change with time.<\/p>\n<p>Key features of gganimate:<\/p>\n<ul>\n<li><strong>transitions<\/strong>: you want your data to change<\/li>\n<li><strong>views<\/strong>: you want your viewpoint to change<\/li>\n<li><strong>shadows<\/strong>: you want the animation to have memory<\/li>\n<\/ul>\n<p>Contents:<\/p>\n<div id=\"TOC\">\n<ul>\n<li><a href=\"#prerequisites\">Prerequisites<\/a><\/li>\n<li><a href=\"#demo-dataset\">Demo dataset<\/a><\/li>\n<li><a href=\"#static-plot\">Static plot<\/a><\/li>\n<li><a href=\"#transition-through-distinct-states-in-time\">Transition through distinct states in time<\/a>\n<ul>\n<li><a href=\"#basics\">Basics<\/a><\/li>\n<li><a href=\"#let-the-view-follow-the-data-in-each-frame\">Let the view follow the data in each frame<\/a><\/li>\n<li><a href=\"#show-preceding-frames-with-gradual-falloff\">Show preceding frames with gradual falloff<\/a><\/li>\n<li><a href=\"#show-the-original-data-as-background-marks\">Show the original data as background marks<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#reveal-data-along-a-given-dimension\">Reveal data along a given dimension<\/a>\n<ul>\n<li><a href=\"#static-plot-1\">Static plot<\/a><\/li>\n<li><a href=\"#let-data-gradually-appear\">Let data gradually appear<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#transition-between-several-distinct-stages-of-the-data\">Transition between several distinct stages of the data<\/a><\/li>\n<li><a href=\"#save-animation\">Save animation<\/a><\/li>\n<li><a href=\"#read-more\">Read more<\/a><\/li>\n<\/ul>\n<\/div>\n<div id=\"prerequisites\" class=\"section level2\">\n<h2>Prerequisites<\/h2>\n<p>gganimate stable version is available on CRAN and can be installed with <code>install.packages('gganimate')<\/code>. The latest development version can be installed as follow: <code>devtools::install_github('thomasp85\/gganimate')<\/code>.<\/p>\n<div class=\"warning\">\n<p>Note that, in this tutorial, we used the latest developmental version.<\/p>\n<\/div>\n<p>Load required packages and set the default ggplot2 theme to <code>theme_bw()<\/code>:<\/p>\n<pre class=\"r\"><code>library(ggplot2)\r\nlibrary(gganimate)\r\ntheme_set(theme_bw())<\/code><\/pre>\n<\/div>\n<div id=\"demo-dataset\" class=\"section level2\">\n<h2>Demo dataset<\/h2>\n<pre class=\"r\"><code>library(gapminder)\r\nhead(gapminder)<\/code><\/pre>\n<pre><code>## # A tibble: 6 x 6\r\n##   country     continent  year lifeExp      pop gdpPercap\r\n##   &lt;fct&gt;       &lt;fct&gt;     &lt;int&gt;   &lt;dbl&gt;    &lt;int&gt;     &lt;dbl&gt;\r\n## 1 Afghanistan Asia       1952    28.8  8425333      779.\r\n## 2 Afghanistan Asia       1957    30.3  9240934      821.\r\n## 3 Afghanistan Asia       1962    32.0 10267083      853.\r\n## 4 Afghanistan Asia       1967    34.0 11537966      836.\r\n## 5 Afghanistan Asia       1972    36.1 13079460      740.\r\n## 6 Afghanistan Asia       1977    38.4 14880372      786.<\/code><\/pre>\n<\/div>\n<div id=\"static-plot\" class=\"section level2\">\n<h2>Static plot<\/h2>\n<pre class=\"r\"><code>p &lt;- ggplot(\r\n  gapminder, \r\n  aes(x = gdpPercap, y=lifeExp, size = pop, colour = country)\r\n  ) +\r\n  geom_point(show.legend = FALSE, alpha = 0.7) +\r\n  scale_color_viridis_d() +\r\n  scale_size(range = c(2, 12)) +\r\n  scale_x_log10() +\r\n  labs(x = \"GDP per capita\", y = \"Life expectancy\")\r\np<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/figures\/gganimate-static-plot-1.png\" width=\"384\" \/><\/p>\n<\/div>\n<div id=\"transition-through-distinct-states-in-time\" class=\"section level2\">\n<h2>Transition through distinct states in time<\/h2>\n<div id=\"basics\" class=\"section level3\">\n<h3>Basics<\/h3>\n<p>Key R function: <code>transition_time()<\/code>. The transition length between the states will be set to correspond to the actual time difference between them.<\/p>\n<p>Label variables: <code>frame_time<\/code>. Gives the time that the current frame corresponds to.<\/p>\n<pre class=\"r\"><code>p + transition_time(year) +\r\n  labs(title = \"Year: {frame_time}\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/transition_time.gif\" alt=\"Transition time\" \/><\/p>\n<p>Create facets by continent:<\/p>\n<pre class=\"r\"><code>p + facet_wrap(~continent) +\r\n  transition_time(year) +\r\n  labs(title = \"Year: {frame_time}\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/transition_time-faceted.gif\" alt=\"Transition time, facet by continents\" \/><\/p>\n<\/div>\n<div id=\"let-the-view-follow-the-data-in-each-frame\" class=\"section level3\">\n<h3>Let the view follow the data in each frame<\/h3>\n<pre class=\"r\"><code>p + transition_time(year) +\r\n  labs(title = \"Year: {frame_time}\") +\r\n  view_follow(fixed_y = TRUE)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/view_follow.gif\" alt=\"View follow\" \/><\/p>\n<\/div>\n<div id=\"show-preceding-frames-with-gradual-falloff\" class=\"section level3\">\n<h3>Show preceding frames with gradual falloff<\/h3>\n<p>This shadow is meant to draw a small wake after data by showing the latest frames up to the current. You can choose to gradually diminish the size and\/or opacity of the shadow. The length of the wake is not given in absolute frames as that would make the animation susceptible to changes in the framerate. Instead it is given as a proportion of the total length of the animation.<\/p>\n<pre class=\"r\"><code>p + transition_time(year) +\r\n  labs(title = \"Year: {frame_time}\") +\r\n  shadow_wake(wake_length = 0.1, alpha = FALSE)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/shadow_wake.gif\" alt=\"Shadow Wake\" \/><\/p>\n<\/div>\n<div id=\"show-the-original-data-as-background-marks\" class=\"section level3\">\n<h3>Show the original data as background marks<\/h3>\n<p>This shadow lets you show the raw data behind the current frame. Both past and\/or future raw data can be shown and styled as you want.<\/p>\n<pre class=\"r\"><code>p + transition_time(year) +\r\n  labs(title = \"Year: {frame_time}\") +\r\n  shadow_mark(alpha = 0.3, size = 0.5)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/shadow_mark.gif\" alt=\"Shadow Mark\" \/><\/p>\n<\/div>\n<\/div>\n<div id=\"reveal-data-along-a-given-dimension\" class=\"section level2\">\n<h2>Reveal data along a given dimension<\/h2>\n<p>This transition allows you to let data gradually appear, based on a given time dimension.<\/p>\n<div id=\"static-plot-1\" class=\"section level3\">\n<h3>Static plot<\/h3>\n<pre class=\"r\"><code>p &lt;- ggplot(\r\n  airquality,\r\n  aes(Day, Temp, group = Month, color = factor(Month))\r\n  ) +\r\n  geom_line() +\r\n  scale_color_viridis_d() +\r\n  labs(x = \"Day of Month\", y = \"Temperature\") +\r\n  theme(legend.position = \"top\")\r\np<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/figures\/gganimate-line-plot-1.png\" width=\"480\" \/><\/p>\n<\/div>\n<div id=\"let-data-gradually-appear\" class=\"section level3\">\n<h3>Let data gradually appear<\/h3>\n<ul>\n<li>Reveal by day (x-axis)<\/li>\n<\/ul>\n<pre class=\"r\"><code>p + transition_reveal(Day)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/let-data-gradually-appear.gif\" alt=\"Let data gradually appear\" \/><\/p>\n<ul>\n<li>Show points:<\/li>\n<\/ul>\n<pre class=\"r\"><code>p + \r\n  geom_point() +\r\n  transition_reveal(Day)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/let-data-gradually-appear-show-points.gif\" alt=\"Let data gradually appear\" \/><\/p>\n<ul>\n<li>Points can be kept by giving them a unique group:<\/li>\n<\/ul>\n<pre class=\"r\"><code>p + \r\n  geom_point(aes(group = seq_along(Day))) +\r\n  transition_reveal(Day)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/let-data-gradually-appear-keep-points.gif\" alt=\"Let data gradually appear, keep points\" \/><\/p>\n<\/div>\n<\/div>\n<div id=\"transition-between-several-distinct-stages-of-the-data\" class=\"section level2\">\n<h2>Transition between several distinct stages of the data<\/h2>\n<p>Data preparation:<\/p>\n<pre class=\"r\"><code>library(dplyr)\r\nmean.temp &lt;- airquality %&gt;%\r\n  group_by(Month) %&gt;%\r\n  summarise(Temp = mean(Temp))\r\nmean.temp<\/code><\/pre>\n<pre><code>## # A tibble: 5 x 2\r\n##   Month  Temp\r\n##   &lt;int&gt; &lt;dbl&gt;\r\n## 1     5  65.5\r\n## 2     6  79.1\r\n## 3     7  83.9\r\n## 4     8  84.0\r\n## 5     9  76.9<\/code><\/pre>\n<p>Create a bar plot of mean temperature:<\/p>\n<pre class=\"r\"><code>p &lt;- ggplot(mean.temp, aes(Month, Temp, fill = Temp)) +\r\n  geom_col() +\r\n  scale_fill_distiller(palette = \"Reds\", direction = 1) +\r\n  theme_minimal() +\r\n  theme(\r\n    panel.grid = element_blank(),\r\n    panel.grid.major.y = element_line(color = \"white\"),\r\n    panel.ontop = TRUE\r\n  )\r\np<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/figures\/gganimate-static-barplot-1.png\" width=\"480\" \/><\/p>\n<ul>\n<li>transition_states():<\/li>\n<\/ul>\n<pre class=\"r\"><code>p + transition_states(Month, wrap = FALSE) +\r\n  shadow_mark()<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/r-tutorial\/images\/transition_states.gif\" alt=\"transition states\" \/><\/p>\n<ul>\n<li>enter_grow() + enter_fade()<\/li>\n<\/ul>\n<pre class=\"r\"><code>p + transition_states(Month, wrap = FALSE) +\r\n  shadow_mark() +\r\n  enter_grow() +\r\n  enter_fade()<\/code><\/pre>\n<\/div>\n<div id=\"save-animation\" class=\"section level2\">\n<h2>Save animation<\/h2>\n<p>If you need to save the animation for later use you can use the <code>anim_save()<\/code> function.<\/p>\n<p>It works much like <code>ggsave()<\/code> from ggplot2 and automatically grabs the last rendered animation if you do not specify one directly.<\/p>\n<p>Example of usage:<\/p>\n<\/div>\n<div id=\"read-more\" class=\"section level2\">\n<h2>Read more<\/h2>\n<ul>\n<li><a href=\"https:\/\/gganimate.com\/index.html\">gganimate official documentation website<\/a><\/li>\n<\/ul>\n<\/div>\n<\/div>\n<p><!--end rdoc--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article describes how to create animation in R using the gganimate R package. gganimate is an extension of the ggplot2 package for creating animated ggplots. It provides a range [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7784,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rating_form_position":"","rating_results_position":"","mr_structured_data_type":"","footnotes":""},"categories":[134],"tags":[137],"class_list":["post-8487","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-visualization","tag-ggplot2-extensions"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>gganimate: How to Create Plots with Beautiful Animation in R - Datanovia<\/title>\n<meta name=\"description\" content=\"This article describes how to create animation in R using the gganimate R package.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"gganimate: How to Create Plots with Beautiful Animation in R - Datanovia\" \/>\n<meta property=\"og:description\" content=\"This article describes how to create animation in R using the gganimate R package.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Datanovia\" \/>\n<meta property=\"article:published_time\" content=\"2019-01-24T22:18:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-12-25T08:48:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0600.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Alboukadel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alboukadel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/\"},\"author\":{\"name\":\"Alboukadel\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e\"},\"headline\":\"gganimate: How to Create Plots with Beautiful Animation in R\",\"datePublished\":\"2019-01-24T22:18:09+00:00\",\"dateModified\":\"2019-12-25T08:48:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/\"},\"wordCount\":468,\"commentCount\":27,\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0600.jpg\",\"keywords\":[\"ggplot2 extensions\"],\"articleSection\":[\"Data Visualization\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/\",\"name\":\"gganimate: How to Create Plots with Beautiful Animation in R - Datanovia\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0600.jpg\",\"datePublished\":\"2019-01-24T22:18:09+00:00\",\"dateModified\":\"2019-12-25T08:48:55+00:00\",\"description\":\"This article describes how to create animation in R using the gganimate R package.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#primaryimage\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0600.jpg\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0600.jpg\",\"width\":1024,\"height\":512},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.datanovia.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"gganimate: How to Create Plots with Beautiful Animation in R\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"name\":\"Datanovia\",\"description\":\"Data Mining and Statistics for Decision Support\",\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.datanovia.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\",\"name\":\"Datanovia\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"width\":98,\"height\":99,\"caption\":\"Datanovia\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e\",\"name\":\"Alboukadel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g\",\"caption\":\"Alboukadel\"},\"url\":\"https:\/\/www.datanovia.com\/en\/blog\/author\/kassambara\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"gganimate: How to Create Plots with Beautiful Animation in R - Datanovia","description":"This article describes how to create animation in R using the gganimate R package.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/","og_locale":"en_US","og_type":"article","og_title":"gganimate: How to Create Plots with Beautiful Animation in R - Datanovia","og_description":"This article describes how to create animation in R using the gganimate R package.","og_url":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/","og_site_name":"Datanovia","article_published_time":"2019-01-24T22:18:09+00:00","article_modified_time":"2019-12-25T08:48:55+00:00","og_image":[{"width":1024,"height":512,"url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0600.jpg","type":"image\/jpeg"}],"author":"Alboukadel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Alboukadel","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#article","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/"},"author":{"name":"Alboukadel","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e"},"headline":"gganimate: How to Create Plots with Beautiful Animation in R","datePublished":"2019-01-24T22:18:09+00:00","dateModified":"2019-12-25T08:48:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/"},"wordCount":468,"commentCount":27,"publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0600.jpg","keywords":["ggplot2 extensions"],"articleSection":["Data Visualization"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/","url":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/","name":"gganimate: How to Create Plots with Beautiful Animation in R - Datanovia","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#primaryimage"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0600.jpg","datePublished":"2019-01-24T22:18:09+00:00","dateModified":"2019-12-25T08:48:55+00:00","description":"This article describes how to create animation in R using the gganimate R package.","breadcrumb":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#primaryimage","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0600.jpg","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_0600.jpg","width":1024,"height":512},{"@type":"BreadcrumbList","@id":"https:\/\/www.datanovia.com\/en\/blog\/gganimate-how-to-create-plots-with-beautiful-animation-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.datanovia.com\/en\/"},{"@type":"ListItem","position":2,"name":"gganimate: How to Create Plots with Beautiful Animation in R"}]},{"@type":"WebSite","@id":"https:\/\/www.datanovia.com\/en\/#website","url":"https:\/\/www.datanovia.com\/en\/","name":"Datanovia","description":"Data Mining and Statistics for Decision Support","publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.datanovia.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.datanovia.com\/en\/#organization","name":"Datanovia","url":"https:\/\/www.datanovia.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","width":98,"height":99,"caption":"Datanovia"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e","name":"Alboukadel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g","caption":"Alboukadel"},"url":"https:\/\/www.datanovia.com\/en\/blog\/author\/kassambara\/"}]}},"multi-rating":{"mr_rating_results":[]},"_links":{"self":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/8487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/comments?post=8487"}],"version-history":[{"count":3,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/8487\/revisions"}],"predecessor-version":[{"id":8490,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/8487\/revisions\/8490"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media\/7784"}],"wp:attachment":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media?parent=8487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/categories?post=8487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/tags?post=8487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}