Skip to contents

Creates a bar chart race animation where bars grow, shrink, and reorder over time based on changing data.

Usage

animate_bar_race(
  data,
  category,
  value,
  time_step,
  n_bars = 10,
  bar_color = BLUE,
  duration = 10,
  axes_range = NULL
)

Arguments

data

A data.frame with columns: category, value, time_step

category

Column name for bar labels

value

Column name for bar values

time_step

Column name for time steps

n_bars

Number of bars to show at once

bar_color

Bar color (or column name)

duration

Total animation duration

axes_range

Optional y-axis range

Value

A Scene object