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

Clean warnings in examples #6239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 1, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use floordiv as sugested by QuLogic
  • Loading branch information
jenshnielsen committed Mar 30, 2016
commit d82de883d4c91ca8ff23bfdfe24744593e3c50bb
2 changes: 1 addition & 1 deletion 2 examples/pylab_examples/centered_ticklabels.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
tick.tick2line.set_markersize(0)
tick.label1.set_horizontalalignment('center')

imid = int(len(r)/2)
imid = len(r)//2
ax.set_xlabel(str(r.date[imid].year))
plt.show()
4 changes: 2 additions & 2 deletions 4 examples/pylab_examples/data_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ def get_two_stock_data():
file2 = cbook.get_sample_data('AAPL.dat.gz')
M1 = fromstring(file1.read(), '<d')

M1 = resize(M1, (int(M1.shape[0]/2), 2))
M1 = resize(M1, (M1.shape[0]//2, 2))

M2 = fromstring(file2.read(), '<d')
M2 = resize(M2, (int(M2.shape[0]/2), 2))
M2 = resize(M2, (M2.shape[0]//2, 2))

d1, p1 = M1[:, 0], M1[:, 1]
d2, p2 = M2[:, 0], M2[:, 1]
Expand Down
6 changes: 3 additions & 3 deletions 6 examples/pylab_examples/image_slices_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ def __init__(self, ax, X):

self.X = X
rows, cols, self.slices = X.shape
self.ind = int(self.slices/2)
self.ind = self.slices//2

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

def onscroll(self, event):
print("%s %s" % (event.button, event.step))
if event.button == 'up':
self.ind = int(numpy.clip(self.ind + 1, 0, self.slices - 1))
self.ind = numpy.clip(self.ind + 1, 0, self.slices - 1)
else:
self.ind = int(numpy.clip(self.ind - 1, 0, self.slices - 1))
self.ind = numpy.clip(self.ind - 1, 0, self.slices - 1)
self.update()

def update(self):
Expand Down
8 changes: 4 additions & 4 deletions 8 examples/pylab_examples/quiver_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
# 6
plt.figure()
M = np.zeros(U.shape, dtype='bool')
XMaskStart = int(U.shape[0]/3)
YMaskStart = int(U.shape[1]/3)
XMaskStop = int(2*U.shape[0]/3)
YMaskStop = int(2*U.shape[1]/3)
XMaskStart = U.shape[0]//3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is a bit un-Pythonic, but otherwise the PR is fine.

YMaskStart = U.shape[1]//3
XMaskStop = 2*U.shape[0]//3
YMaskStop = 2*U.shape[1]//3

M[XMaskStart:XMaskStop,
YMaskStart:YMaskStop] = True
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.