Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Animate time series as bar charts
ResourceFunction["RankedTimeSeriesBarChart"][{ts1,ts2.…}] creates an animated BarChart visualization of the time series tsi. | |
ResourceFunction["RankedTimeSeriesBarChart"][{ts1,ts2.…},{min,max}] animates over the specified timespan min–max. | |
ResourceFunction["RankedTimeSeriesBarChart"][{ts1,ts2.…},{min,max,delta}] uses step size delta. | |
ResourceFunction["RankedTimeSeriesBarChart"][{ts1,ts2.…},{{t1,t2,…}}] shows values only at the specified times. |
"AnimateOptions" | {} | options for Animate |
BarOrigin | Left | origin placement for bars |
ChartLabels | Automatic | labels for data elements |
ChartStyle | Automatic | by default, colors each element consistently throughout animation |
"PlotLabelFunction" | Automatic | function to create a plot label from the timestamp |
PlotRange | Full | range to show while animating |
"RankingFunction" | Sort | function to rank bars |
Create an animation of two time series:
In[1]:= | ![]() |
Out[1]= | ![]() |
Create an animation of GDP per capita for a few countries over a few decades:
In[2]:= | ![]() |
Out[2]= | ![]() |
In[3]:= | ![]() |
Out[3]= | ![]() |
Create an animation for a list of raw data sequences. Note that integer labels are automatically assigned:
In[4]:= | ![]() |
Out[4]= | ![]() |
Retrieve data on COVID-19 cases from five random countries:
In[5]:= | ![]() |
Out[5]= | ![]() |
Animate the full data:
In[6]:= | ![]() |
Out[6]= | ![]() |
Animate only over a specific date range:
In[7]:= | ![]() |
Out[7]= | ![]() |
Animate at specific times:
In[8]:= | ![]() |
Out[8]= | ![]() |
Animate the highest scoring Major League Baseball game ever by directly specifying the time steps:
In[9]:= | ![]() |
Out[9]= | ![]() |
All options to Animate are accepted as suboptions using "AnimateOptions":
In[10]:= | ![]() |
Out[10]= | ![]() |
By default, chart labels are always shown, even when none are supplied:
In[12]:= | ![]() |
Out[12]= | ![]() |
Use the ChartLabels option to remove the labels:
In[13]:= | ![]() |
Out[13]= | ![]() |
By default, the plot is labeled with a DateObject for time series based on dates and a timestamp for other time series:
In[14]:= | ![]() |
Out[14]= | ![]() |
Specify a function to create a plot label from the timestamps:
In[15]:= | ![]() |
Out[15]= | ![]() |
The input to "PlotLabelFunction" is AbsoluteTime values:
In[16]:= | ![]() |
Out[16]= | ![]() |
Use a pure function to create custom label containing any content:
In[17]:= | ![]() |
Out[17]= | ![]() |
By default the plot range is static throughout the animation:
In[18]:= | ![]() |
Out[18]= | ![]() |
Set the PlotRange option to Automatic to have dynamic ranges that adjust as the data changes:
In[19]:= | ![]() |
Out[19]= | ![]() |
Specify how the bars should be sorted using "RankingFunction":
In[20]:= | ![]() |
Out[20]= | ![]() |
Maintain the order from the input using Identity. The first element is on bottom:
In[21]:= | ![]() |
Out[21]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License