8000 STY: update example with preferred plt.subplots() · matplotlib/matplotlib@e36a734 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e36a734

Browse files
committed
STY: update example with preferred plt.subplots()
1 parent be216b2 commit e36a734

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/images_contours_and_fields/streamplot_demo_features.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
V = 1 + X - Y**2
1717
speed = np.sqrt(U*U + V*V)
1818

19-
plt.streamplot(X, Y, U, V, color=U, linewidth=2, cmap=plt.cm.autumn)
20-
plt.colorbar()
19+
fig0, ax0 = plt.subplots()
20+
strm = ax0.streamplot(X, Y, U, V, color=U, linewidth=2, cmap=plt.cm.autumn)
21+
fig0.colorbar(strm.lines)
2122

22-
f, (ax1, ax2) = plt.subplots(ncols=2)
23+
fig1, (ax1, ax2) = plt.subplots(ncols=2)
2324
ax1.streamplot(X, Y, U, V, density=[0.5, 1])
2425

25-
lw = 5*speed/speed.max()
26+
lw = 5*speed / speed.max()
2627
ax2.streamplot(X, Y, U, V, density=0.6, color='k', linewidth=lw)
2728

2829
plt.show()

0 commit comments

Comments
 (0)
0