Plotly supports an excellent foundation for animated plots. I highly recommend their basic tutorial here. However, plotly animations are primarily set up to add another dimension to the visualization — usually time. This is fantastic for adding more meaning to a plot.
Animation, however, doesn’t have to be used to add complexity to a plot. The ability to emphasize with animation is powerful. When we have the pivotal graph for our audience, we want to pull in their attention without explicitly shouting “This is the plot you should really pay attention to!” Our eyes are naturally drawn to things moving, and animated plots can have a way of building up anticipation. Your audience engages and mentally tries to anticipate next bar or line in real time. Imagine if key business decisions hinge on this plot — your audience waits with baited breath while the results unfold before their eyes!
To put it in perspective — imagine you’re 20 minutes into a colleague’s presentation — which graph grabs your attention? This simple (pandas-generated) graph:
Or this animated graph of the same data:
To pull this off in Plotly, we actually have to reshuffle our data a bit. Again, Plotly animations are set up to step with some sequence (usually time). So, we’re going to stretch our data to effectively make a frame for each data point. Here we go:
First, let’s import the plotly package (install with pip if you haven’t already), and create a dummy data set to work with: