heatmap ranges (“my agent colors are inconsistent”)


If you’re using sns.heatmap() to draw your animation, and you have colors mapped to integer values (like no-agent-here = 0, susceptible = 1, infected = 2, recovered = 3), be sure to set the range to fixed values via the vmin and vmax arguments. In this case, you would want to set vmin=0 and vmax=3 so that in every frame of the animation, the heatmap assigns the same colors to the same values rather than re-calibrating each time.