rk.gganimate is an advanced RKWard GUI plugin suite that brings the power of gganimate, ggplot2, and srvyr into a point-and-click interface. Designed for data storytelling, it allows researchers to easily aggregate complex survey data (or standard data frames) and render stunning, publication-ready animated GIFs—including Gapminder-style bubble charts, dynamic line charts, and viral Bar Chart Races.
ggplot2 syntax.survey.design) into lightweight 3D cubes (X, Y, Size) ready for animation.This update brings refined Storytelling controls inspired by Storytelling with Data (SWD) principles, along with crucial UI and engine optimizations:
ggplot2 rendering bug (+<- error) caused by dangling layers in the Bar Chart Race. Additionally, all require() statements are now strictly consolidated into RKWard's ## Preparar block, ensuring cleaner and faster R script generation.This major update expands the plugin suite beyond bubble charts, introducing two highly requested animation formats and advanced storytelling features:
geom_tile(), and supports injecting logos/images at the end of the bars using ggimage.transition_reveal(). Features a "Storytelling" tab to highlight a specific group (drawing its line thicker and in focus color) while keeping the rest as gray background context. Includes a toggle for view_follow() to let the axes dynamically expand as the data grows.This major update transforms the plugin into a highly flexible tool for multi-dimensional data storytelling:
dplyr::filter box has been added directly to the Animated Bubble Chart interface. You can now subset your animations on-the-fly (e.g., sec_est == "Manufactura") without needing to create new tables in your workspace.ggrepel) now dynamically attach strictly to the filtered subset, preventing "ghost" labels from invisible categories from ruining your animations.This update focuses on fine-tuning the visual output, adding publication-ready details, and improving the user interface:
✨ New Features & Improvements:
.rk.meta or variable.label) directly from your data frame, keeping your charts looking professional automatically..po/.mo) for Spanish, French, German, and Brazilian Portuguese have been updated to cover all the new UI elements.tabla_animacion), preventing RKWard from duplicating objects or losing metadata upon saving.getCol() helper with a robust regex to properly parse deeply nested survey.design variables. It now correctly identifies the actual column names (e.g., ent, year) instead of getting stuck on the internal [["variables"]] list structure.You must have RKWard installed along with the following R packages:
install.packages(c("ggplot2", "gganimate", "gifski", "transformr", "srvyr", "dplyr", "ggimage"))
You can install this plugin directly from GitHub using devtools:
# Install the plugin
# remotes::install_github("AlfCano/rk.gganimate")
install.packages("rk.gganimate", repos = c('https://alfcano.r-universe.dev', 'https://cloud.r-project.org'))
Once installed, open RKWard, navigate to Settings -> Configure RKWard -> Plugins, and activate rk.gganimate.
This plugin adds a two-step toolkit under Survey -> Graphs -> Animations.
This tool crunches heavy survey data (millions of rows) into a lightweight table (one row per group per year) required for Gapminder-style animations.
survey.design object.year) and one or more Grouping variables (e.g., State and Sector).tabla_animacion) will be saved to your workspace.tabla_animacion. Map your calculated X, Y, Size, and Color variables. Use the new Optional Filter box to dynamically subset your animation (e.g., Sector == 'Manufacturing').Puebla, Jalisco to only display names for those specific bubbles while they move).Shows growth over time using transition_reveal().
The viral sliding bar ranking chart.
To test the generated plugin and see the Storytelling tracking in action, paste this into the RKWard console to create a mock summarized dataset:
# Create a Mock Summarized Dataset (Gapminder Style)
set.seed(123)
mock_anim_data <- expand.grid(Year = 2010:2020, State = c("Puebla", "Jalisco", "Nuevo Leon", "CDMX", "Oaxaca"))
mock_anim_data$Income <- runif(nrow(mock_anim_data), 10000, 30000) + (mock_anim_data$Year - 2010) * 1000
mock_anim_data$Poverty_Pct <- runif(nrow(mock_anim_data), 20, 60) - (mock_anim_data$Year - 2010) * 1.5
mock_anim_data$Population <- runif(nrow(mock_anim_data), 1e6, 5e6)
Step-by-step Test:
Survey > Graphs > Animations > 2. Animated Bubble Chart
mock_anim_data
Poverty_Pct
Income
Year
Population
State
Labels & Theme Tab:
Poverty vs Income (2010-2020)
Puebla, Nuevo Leon
Render & Export Tab:
test_animation.gif.Result: Check your Desktop. You will have a fluid 8-second animation where all bubbles move, but only "Puebla" and "Nuevo Leon" have a bold, floating label tracking their exact movement across the screen!
The graphical interface automatically adapts to your RKWard language settings. Currently supported languages:
Author: Alfonso Cano (@AlfCano) Email: alfonso.cano@correo.buap.mx
This project is licensed under the GPL (>= 3) License.