Animating particles in a flow

This article demonstrates matplotlib's animation module by animating marker particles in a fluid flow around a cylinder. It's a bit long because it ties together a number of different ideas:

  • stream functions
  • numerical integration
  • plotting and animation

Before we really start, let's copy a function from a ...

more ...

Line-color cycling

When plotting a series of lines, it's nice to pull a series of colors from a colormap (especially if there's some sequential relationship between lines). In fact, this has been asked (and answered) multiple times on the Matplotlib mailing list (e.g., [1] and [2]) and on StackOverflow ...

more ...