Skip to content

Commit 71e23b8

Browse files
timhoffmmeeseeksmachine
authored andcommitted
Backport PR #21124: Tweak streamplot plot_types example.
1 parent 09ad38c commit 71e23b8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

plot_types/arrays/streamplot.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@
1313
# make a stream function:
1414
X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256))
1515
Z = (1 - X/2. + X**5 + Y**3) * np.exp(-X**2 - Y**2)
16-
Z = Z - Z.min()
1716
# make U and V out of the streamfunction:
1817
V = np.diff(Z[1:, :], axis=1)
1918
U = -np.diff(Z[:, 1:], axis=0)
2019

2120
# plot:
2221
fig, ax = plt.subplots()
23-
# contour stream function
24-
ax.contour(X, Y, Z, colors='C1', alpha=0.5, zorder=1, linewidths=3)
22+
ax.grid(False)
23+
2524
# plot stream plot
26-
ax.streamplot(X[1:, 1:], Y[1:, 1:], U, V, zorder=2)
25+
ax.streamplot(X[1:, 1:], Y[1:, 1:], U, V)
2726

2827
plt.show()

0 commit comments

Comments
 (0)