Skip to content

Commit e8124d7

Browse files
committed
More examples working.
svn path=/branches/transforms/; revision=3998
1 parent d39c5b8 commit e8124d7

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

examples/poly_editor.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ def poly_changed(self, poly):
6868

6969
def get_ind_under_point(self, event):
7070
'get the index of the vertex under point if within epsilon tolerance'
71-
x, y = zip(*self.poly.xy)
7271

7372
# display coords
74-
xt, yt = self.poly.get_transform().numerix_x_y(x, y)
73+
xy = npy.asarray(self.poly.xy)
74+
xyt = self.poly.get_transform().transform(xy)
75+
xt, yt = xyt[:, 0], xyt[:, 1]
7576
d = sqrt((xt-event.x)**2 + (yt-event.y)**2)
7677
indseq = nonzero(equal(d, amin(d)))
7778
ind = indseq[0]
@@ -130,7 +131,7 @@ def motion_notify_callback(self, event):
130131
x,y = event.xdata, event.ydata
131132
self.poly.xy[self._ind] = x,y
132133
self.line.set_data(zip(*self.poly.xy))
133-
134+
134135
self.canvas.restore_region(self.background)
135136
self.ax.draw_artist(self.poly)
136137
self.ax.draw_artist(self.line)

examples/wxcursor_demo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"""
44

55
import matplotlib
6+
matplotlib.use('WXAgg')
7+
68
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
79
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
810
from matplotlib.figure import Figure
@@ -65,6 +67,5 @@ def OnInit(self):
6567
return True
6668

6769
if __name__=='__main__':
68-
matplotlib.use('WXAgg')
6970
app = App(0)
7071
app.MainLoop()

lib/matplotlib/backends/backend_wx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,7 @@ def OnPrintPage(self, page):
20432043
vscale = float(ppw) / fig_dpi
20442044

20452045
# set figure resolution,bg color for printer
2046-
self.canvas.figure.dpi.set(ppw)
2046+
self.canvas.figure.dpi = ppw
20472047
self.canvas.figure.set_facecolor('#FFFFFF')
20482048

20492049
renderer = RendererWx(self.canvas.bitmap, self.canvas.figure.dpi)

lib/matplotlib/patches.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,8 @@ def __init__(self, xy, **kwargs):
506506
See Patch documentation for additional kwargs
507507
"""
508508
Patch.__init__(self, **kwargs)
509-
self.xy = xy
510509
self._path = Path(xy, closed=True)
510+
self.xy = self._path.vertices
511511
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
512512

513513
def get_path(self):

lib/matplotlib/transforms.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,7 @@ def transform_point(self, point):
927927
The transformed point is returned as a sequence of length
928928
self.output_dims.
929929
"""
930+
assert len(point) == 2
930931
return self.transform(npy.asarray([point]))[0]
931932

932933
def transform_path(self, path):

0 commit comments

Comments
 (0)