Dynamic Graph

Make a dynamic graph by gganmate and ggplots
GGplot2
GGanmate
Analysis
Author

NING LI

Published

Dec 01, 2022

Here is an example shows how to use gganmate package to make a dynamic graph.

gganmate

Data from mtcars

library(ggplot2)
library(gganimate)

ggplot(mtcars, aes(factor(cyl), mpg)) + 
  geom_boxplot() + 
  # Here comes the gganimate code
  transition_states(
    gear,
    transition_length = 2,
    state_length = 1
  ) +
  enter_fade() + 
  exit_shrink() +
  ease_aes('sine-in-out')
Back to top