From: Bowen, B. M <bm...@sa...> - 2006-01-09 19:24:56
|
The value of 'pos' is 'None'. See the output: pos =3D None Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py", line 188, in motion_notify_event FigureCanvasBase.motion_notify_event(self, x, y) File "/usr/lib/python2.4/site-packages/matplotlib/backend_bases.py", line 797, in motion_notify_event func(event) File "/usr/lib/python2.4/site-packages/matplotlib/backend_bases.py", line 1085, in mouse_move try: s =3D event.inaxes.format_coord(event.xdata, event.ydata) File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 611, in format_coord xs =3D self.format_xdata(x) File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 593, in format_xdata val =3D func(x) File "/usr/lib/python2.4/site-packages/matplotlib/ticker.py", line 152, in format_data return self.__call__(value) File "/usr/lib/python2.4/site-packages/matplotlib/ticker.py", line 179, in __call__ else: return self.seq[pos] TypeError: list indices must be integers Brian=20 -----Original Message----- From: mat...@li... [mailto:mat...@li...] On Behalf Of Darren Dale Sent: Monday, January 09, 2006 10:32 AM To: mat...@li... Subject: Re: [Matplotlib-users] setp/xticklabel problem On Monday 09 January 2006 12:02, Bowen, Brian M wrote: > Matplotlib-users, > > I am stuck on a problem in trying to label the xaxis for some plots. I > am trying to do something similar to the following: > > plot([1,2,3,4], [1,4,9,16]) > labels =3D setp(gca(), 'xticklabels', ['one', 'two', 'three', 'four']) = > set(labels, 'rotation', 'vertical') > show() > > > Once the plot is displayed, moving the mouse causes the following=20 > stack > trace: > > TypeError: list indices must be integers Traceback (most recent call > last): > File > "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py", > line 188, in motion_notify_event > FigureCanvasBase.motion_notify_event(self, x, y) > File "/usr/lib/python2.4/site-packages/matplotlib/backend_bases.py", > line 797, in motion_notify_event > func(event) > File "/usr/lib/python2.4/site-packages/matplotlib/backend_bases.py", > line 1085, in mouse_move > try: s =3D event.inaxes.format_coord(event.xdata, event.ydata) > File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line=20 > 611, in format_coord > xs =3D self.format_xdata(x) > File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line=20 > 593, in format_xdata > val =3D func(x) > File "/usr/lib/python2.4/site-packages/matplotlib/ticker.py", line=20 > 152, in format_data > return self.__call__(value) > File "/usr/lib/python2.4/site-packages/matplotlib/ticker.py", line=20 > 178, in __call__ > else: return self.seq[pos] > > > Line 3 of the code seems to be the culprit. Does anyone have any idea=20 > on how I might be able to workaround this? I have seen posts=20 > describing issues that seem to be related to the same problem, but I=20 > have not seen a solution. That doesnt make any sense to me. Line 152 calls self.__call__ with only one argument, which means the pos argument is initialized to none, and an empty string should be returned. We need to know what the value of pos is, please replace line 178 with this: else:=20 print pos return self.seq[pos] and post the result. Darren ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |