Hello, When I try to use transData.transform on a log plot, an error occurs : ... File "E:\Python26\lib\site-packages\matplotlib\transforms.py", line 1895, in transform self._a.transform(points)) File "E:\Python26\lib\site-packages\matplotlib\transforms.py", line 1723, in transform x_points = x.transform(points[:, 0]) TypeError: tuple indices must be integers, not tuple
Here is an example : #!/usr/bin/env python import matplotlib matplotlib.use('WXAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas from matplotlib.figure import Figure import wx class CanvasFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) self.SetBackgroundColour(wx.NamedColor("WHITE")) self.figure = Figure() self.axes = self.figure.add_subplot(111) self.axes.set_xscale('log') p1 = (1,1) p2 = (2,2) _x1, _y1 = self.axes.transData.transform(p1) _x2, _y2 = self.axes.transData.transform(p2) _xy = [[_x1, _y1], [_x2, _y2]] xy = self.axes.transData.inverted().transform(_xy) self.axes.plot(xy) self.canvas = FigureCanvas(self, -1, self.figure) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.SetSizer(self.sizer) self.Fit() class App(wx.App): def OnInit(self): frame = CanvasFrame() frame.Show(True) return True app = App(0) app.MainLoop() If I comment the line : self.axes.set_xscale('log'), it works fine. python 2.6.4 wxpython 2.8.10 mpl 0.99 Thanks by advance for your help. Cédrick ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users