From: Bowen, B. M <bm...@sa...> - 2006-01-09 19:49:26
|
I was able to get it to work by doing something similar. However, the x coordinate does not show up in the lower right corner of the plot. I am thinking this might be part of the underlying problem. Thanks for your help, Brian=20 -----Original Message----- From: mat...@li... [mailto:mat...@li...] On Behalf Of Darren Dale Sent: Monday, January 09, 2006 12:33 PM To: mat...@li... Subject: Re: [Matplotlib-users] setp/xticklabel problem On Monday 09 January 2006 14:24, Bowen, Brian M wrote: > The value of 'pos' is 'None'. See the output: Ok, what happens if you replace line 177 with this: if (pos=3D=3DNone) or (pos>=3Dlen(self.seq)): return '' > 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=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 > 179, in __call__ > else: return self.seq[pos] > TypeError: list indices must be integers > > Brian > > -----Original Message----- > From: mat...@li... > [mailto:mat...@li...] On Behalf Of=20 > 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=20 > > "/usr/lib/python2.4/site-packages/matplotlib/backend_bases.py", > > line 797, in motion_notify_event > > func(event) > > File=20 > > "/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 > > 152, in format_data > > return self.__call__(value) > > File "/usr/lib/python2.4/site-packages/matplotlib/ticker.py", line > > 178, in __call__ > > else: return self.seq[pos] > > > > > > Line 3 of the code seems to be the culprit. Does anyone have any=20 > > idea 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 > > have not seen a solution. > > That doesnt make any sense to me. Line 152 calls self.__call__ with=20 > only one argument, which means the pos argument is initialized to=20 > 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: > 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=20 > makes searching your log files as easy as surfing the web. DOWNLOAD=20 > 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 > > > > > ------------------------------------------------------- > 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=20 > makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=3DClick > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Darren S. Dale, Ph.D. Cornell High Energy Synchrotron Source Cornell University 200L Wilson Lab Rt. 366 & Pine Tree Road Ithaca, NY 14853 dd...@co... office: (607) 255-9894 fax: (607) 255-9001 ------------------------------------------------------- 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 |