Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ead3aba

Browse files
committed
Applied Erik's right-click backend_bases fix
svn path=/trunk/matplotlib/; revision=4959
1 parent e16a44e commit ead3aba

4 files changed

Lines changed: 19 additions & 10 deletions

File tree

examples/ginput_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
t = arange(10)
33
plot(t, sin(t))
44
print "Please click"
5-
ginput(3, verbose=True)
5+
x = ginput(3, verbose=True)
66
show()

examples/lasso_demo.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self, ax, data):
3737

3838
facecolors = [d.color for d in data]
3939
self.xys = [(d.x, d.y) for d in data]
40-
40+
fig = ax.figure
4141
self.collection = RegularPolyCollection(
4242
fig.dpi, 6, sizes=(100,),
4343
facecolors=facecolors,
@@ -47,6 +47,7 @@ def __init__(self, ax, data):
4747
ax.add_collection(self.collection)
4848

4949
self.cid = self.canvas.mpl_connect('button_press_event', self.onpress)
50+
self.ind = None
5051

5152
def callback(self, verts):
5253
facecolors = self.collection.get_facecolors()
@@ -60,18 +61,20 @@ def callback(self, verts):
6061
self.canvas.draw_idle()
6162
self.canvas.widgetlock.release(self.lasso)
6263
del self.lasso
63-
64+
self.ind = ind
6465
def onpress(self, event):
6566
if self.canvas.widgetlock.locked(): return
6667
if event.inaxes is None: return
6768
self.lasso = Lasso(event.inaxes, (event.xdata, event.ydata), self.callback)
6869
# acquire a lock on the widget drawing
6970
self.canvas.widgetlock(self.lasso)
7071

71-
data = [Datum(*xy) for xy in rand(100, 2)]
72+
if 0:
73+
74+
data = [Datum(*xy) for xy in rand(100, 2)]
7275

73-
fig = figure()
74-
ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False)
75-
lman = LassoManager(ax, data)
76+
fig = figure()
77+
ax = fig.add_subplot(111, xlim=(0,1), ylim=(0,1), autoscale_on=False)
78+
lman = LassoManager(ax, data)
7679

77-
show()
80+
show()

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,11 +1556,11 @@ def release_zoom(self, event):
15561556
if a.get_xscale()=='log':
15571557
alpha=npy.log(Xmax/Xmin)/npy.log(x1/x0)
15581558
rx1=pow(Xmin/x0,alpha)*Xmin
1559-
x2=pow(Xmax/x0,alpha)*Xmin
1559+
rx2=pow(Xmax/x0,alpha)*Xmin
15601560
else:
15611561
alpha=(Xmax-Xmin)/(x1-x0)
15621562
rx1=alpha*(Xmin-x0)+Xmin
1563-
x2=alpha*(Xmax-x0)+Xmin
1563+
rx2=alpha*(Xmax-x0)+Xmin
15641564
if a.get_yscale()=='log':
15651565
alpha=npy.log(Ymax/Ymin)/npy.log(y1/y0)
15661566
ry1=pow(Ymin/y0,alpha)*Ymin

lib/matplotlib/mlab.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,12 @@ def safe_isnan(x):
19431943
except NotImplementedError: return False
19441944
else: return b
19451945

1946+
def safe_isinf(x):
1947+
'isnan for arbitrary types'
1948+
try: b = npy.isinf(x)
1949+
except NotImplementedError: return False
1950+
else: return b
1951+
19461952

19471953
def rec_append_field(rec, name, arr, dtype=None):
19481954
'return a new record array with field name populated with data from array arr'

0 commit comments

Comments
 (0)