X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion examples/api/power_norm_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
from numpy.random import multivariate_normal

data = np.vstack([multivariate_normal([10, 10], [[2, 2], [2, 2]], size=100000),
data = np.vstack([multivariate_normal([10, 10], [[3, 2], [2, 3]], size=100000),
multivariate_normal([30, 20], [[2, 3], [1, 3]], size=1000)
])

Expand Down
2 changes: 1 addition & 1 deletion 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 = len(r)/2
imid = len(r)//2
ax.set_xlabel(str(r.date[imid].year))
plt.show()
4 changes: 2 additions & 2 deletions 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, (M1.shape[0]/2, 2))
M1 = resize(M1, (M1.shape[0]//2, 2))

M2 = fromstring(file2.read(), '<d')
M2 = resize(M2, (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
10 changes: 4 additions & 6 deletions examples/pylab_examples/image_slices_viewer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import print_function
import numpy
from matplotlib.pyplot import figure, show
import matplotlib.pyplot as plt


class IndexTracker(object):
Expand All @@ -10,7 +10,7 @@ def __init__(self, ax, X):

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

self.im = ax.imshow(self.X[:, :, self.ind])
self.update()
Expand All @@ -21,7 +21,6 @@ def onscroll(self, event):
self.ind = numpy.clip(self.ind + 1, 0, self.slices - 1)
else:
self.ind = numpy.clip(self.ind - 1, 0, self.slices - 1)

self.update()

def update(self):
Expand All @@ -30,13 +29,12 @@ def update(self):
self.im.axes.figure.canvas.draw()


fig = figure()
ax = fig.add_subplot(111)
fig, ax = plt.subplots(1, 1)

X = numpy.random.rand(20, 20, 40)

tracker = IndexTracker(ax, X)


fig.canvas.mpl_connect('scroll_event', tracker.onscroll)
show()
plt.show()
9 changes: 7 additions & 2 deletions examples/pylab_examples/quiver_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@
# 6
plt.figure()
M = np.zeros(U.shape, dtype='bool')
M[U.shape[0]/3:2*U.shape[0]/3,
U.shape[1]/3:2*U.shape[1]/3] = True
XMaskStart = U.shape[0]//3
Copy link
Copy Markdown
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
U = ma.masked_array(U, mask=M)
V = ma.masked_array(V, mask=M)
Q = plt.quiver(U, V)
Expand Down
8 changes: 4 additions & 4 deletions lib/mpl_toolkits/axisartist/grid_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,14 @@ def __init__(self,


class MaxNLocator(mticker.MaxNLocator):
def __init__(self, nbins = 10, steps = None,
trim = True,
def __init__(self, nbins=10, steps=None,
trim=True,
integer=False,
symmetric=False,
prune=None):

# trim argument has no effect. It has been left for API compatibility
mticker.MaxNLocator.__init__(self, nbins, steps=steps,
trim=trim, integer=integer,
integer=integer,
symmetric=symmetric, prune=prune)
self.create_dummy_axis()
self._factor = None
Expand Down
X Tutup