8000 Quiver_demo cast indices to int before indexing numpy array · matplotlib/matplotlib@4b6112e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4b6112e

Browse files
committed
Quiver_demo cast indices to int before indexing numpy array
1 parent aaa3216 commit 4b6112e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

examples/pylab_examples/quiver_demo.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,13 @@
7575
# 6
7676
plt.figure()
7777
M = np.zeros(U.shape, dtype='bool')
78-
M[U.shape[0]/3:2*U.shape[0]/3,
79-
U.shape[1]/3:2*U.shape[1]/3] = True
78+
XMaskStart = int(U.shape[0]/3)
79+
YMaskStart = int(U.shape[1]/3)
80+
XMaskStop = int(2*U.shape[0]/3)
81+
YMaskStop = int(2*U.shape[1]/3)
82+
83+
M[XMaskStart:XMaskStop,
84+
YMaskStart:YMaskStop] = True
8085
U = ma.masked_array(U, mask=M)
8186
V = ma.masked_array(V, mask=M)
8287
Q = plt.quiver(U, V)

0 commit comments

Comments
 (0)
0