Note
Go to the end to download the full example code.
streamplot(X, Y, U, V)#
Draw streamlines of a vector flow.
See streamplot.

import matplotlib.pyplot as plt
import numpy as np
plt.style.use('_mpl-gallery-nogrid')
# make a stream function:
np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
Y**3) * Y**2)
# make U and V out of the streamfunction:
Z[1:, :], axis=1)
Z[:, 1:], axis=0)
# plot:
fig, ax = plt.subplots()
ax.streamplot(V)
plt.show()