Skip to content

Commit f33c8d3

Browse files
committed
DOC: ensure we only pass ints into np slicing
Fix 3 examples that fail under numpy '1.12.0.dev0+cb7f407'
1 parent 81d5a24 commit f33c8d3

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

examples/pylab_examples/data_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ def get_two_stock_data():
1717
file2 = cbook.get_sample_data('AAPL.dat.gz')
1818
M1 = fromstring(file1.read(), '<d')
1919

20-
M1 = resize(M1, (M1.shape[0]/2, 2))
20+
M1 = resize(M1, (M1.shape[0]//2, 2))
2121

2222
M2 = fromstring(file2.read(), '<d')
23-
M2 = resize(M2, (M2.shape[0]/2, 2))
23+
M2 = resize(M2, (M2.shape[0]//2, 2))
2424

2525
d1, p1 = M1[:, 0], M1[:, 1]
2626
d2, p2 = M2[:, 0], M2[:, 1]

examples/pylab_examples/image_slices_viewer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def __init__(self, ax, X):
1010

1111
self.X = X
1212
rows, cols, self.slices = X.shape
13-
self.ind = self.slices/2
13+
self.ind = self.slices//2
1414

1515
self.im = ax.imshow(self.X[:, :, self.ind])
1616
self.update()

examples/pylab_examples/quiver_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@
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+
M[U.shape[0]//3:2*U.shape[0]//3,
79+
U.shape[1]//3:2*U.shape[1]//3] = True
8080
U = ma.masked_array(U, mask=M)
8181
V = ma.masked_array(V, mask=M)
8282
Q = plt.quiver(U, V)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy