From 211cbc06cf1f2c1dfcab9898f87c686b8d916922 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 19 Sep 2021 14:01:52 +0200 Subject: [PATCH] Tweak streamplot plot_types example. - remove contour plot for simplicity. - don't set zorder. - Z doesn't need to be made positive. --- plot_types/arrays/streamplot.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plot_types/arrays/streamplot.py b/plot_types/arrays/streamplot.py index 2cad7d7603e0..d50d9cea6580 100644 --- a/plot_types/arrays/streamplot.py +++ b/plot_types/arrays/streamplot.py @@ -13,16 +13,15 @@ # make a stream function: X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256)) Z = (1 - X/2. + X**5 + Y**3) * np.exp(-X**2 - Y**2) -Z = Z - Z.min() # make U and V out of the streamfunction: V = np.diff(Z[1:, :], axis=1) U = -np.diff(Z[:, 1:], axis=0) # plot: fig, ax = plt.subplots() -# contour stream function -ax.contour(X, Y, Z, colors='C1', alpha=0.5, zorder=1, linewidths=3) +ax.grid(False) + # plot stream plot -ax.streamplot(X[1:, 1:], Y[1:, 1:], U, V, zorder=2) +ax.streamplot(X[1:, 1:], Y[1:, 1:], U, V) plt.show()