Skip to content

Commit 25214c9

Browse files
committed
PEP8 + move titles to to of quiver_demo
1 parent a63fd7f commit 25214c9

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

examples/pylab_examples/quiver_demo.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,25 @@
1515
V = np.sin(Y)
1616

1717
plt.figure()
18+
plt.title('scales with plot width, not view')
1819
Q = plt.quiver(X, Y, U, V, units='width')
1920
qk = plt.quiverkey(Q, 0.9, 0.95, 2, r'$2 \frac{m}{s}$',
2021
labelpos='E',
2122
coordinates='figure',
2223
fontproperties={'weight': 'bold'})
2324
plt.axis([-1, 7, -1, 7])
24-
plt.title('scales with plot width, not view')
2525

2626
plt.figure()
27+
plt.title("pivot='mid'; every third arrow; units='inches'")
2728
Q = plt.quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3],
2829
pivot='mid', color='r', units='inches')
2930
qk = plt.quiverkey(Q, 0.5, 0.03, 1, r'$1 \frac{m}{s}$',
3031
fontproperties={'weight': 'bold'})
3132
plt.plot(X[::3, ::3], Y[::3, ::3], 'k.')
3233
plt.axis([-1, 7, -1, 7])
33-
plt.title("pivot='mid'; every third arrow; units='inches'")
3434

3535
plt.figure()
36+
plt.title("scales with x view; pivot='tip'")
3637
M = np.hypot(U, V)
3738
Q = plt.quiver(X, Y, U, V, M,
3839
units='x',
@@ -44,23 +45,25 @@
4445
fontproperties={'weight': 'bold'})
4546
plt.plot(X, Y, 'k.', markersize=2)
4647
plt.axis([-1, 7, -1, 7])
47-
plt.title("scales with x view; pivot='tip'")
4848

4949
plt.figure()
50+
plt.title("triangular head; scale with x view; black edges")
51+
5052
Q = plt.quiver(X[::3, ::3], Y[::3, ::3], U[::3, ::3], V[::3, ::3],
5153
color='r', units='x',
5254
linewidths=(0.5,), edgecolors=('k'), headaxislength=5)
5355
qk = plt.quiverkey(Q, 0.5, 0.03, 1, r'$1 \frac{m}{s}$',
5456
fontproperties={'weight': 'bold'})
5557
plt.axis([-1, 7, -1, 7])
56-
plt.title("triangular head; scale with x view; black edges")
5758

5859
plt.figure()
60+
plt.title('Minimal arguments, no kwargs - masked values')
61+
5962
M = np.zeros(U.shape, dtype='bool')
60-
XMaskStart = U.shape[0]//3
61-
YMaskStart = U.shape[1]//3
62-
XMaskStop = 2*U.shape[0]//3
63-
YMaskStop = 2*U.shape[1]//3
63+
XMaskStart = U.shape[0] // 3
64+
YMaskStart = U.shape[1] // 3
65+
XMaskStop = 2 * U.shape[0] // 3
66+
YMaskStop = 2 * U.shape[1] // 3
6467

6568
M[XMaskStart:XMaskStop,
6669
YMaskStart:YMaskStop] = True
@@ -72,7 +75,5 @@
7275
l, r, b, t = plt.axis()
7376
dx, dy = r - l, t - b
7477
plt.axis([l - 0.05 * dx, r + 0.05 * dx, b - 0.05 * dy, t + 0.05 * dy])
75-
plt.title('Minimal arguments, no kwargs - masked values')
76-
7778

7879
plt.show()

0 commit comments

Comments
 (0)