setp/xticklabel problem

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

···

-----Original Message-----
From: matplotlib-users-admin@lists.sourceforge.net
[mailto:matplotlib-users-admin@lists.sourceforge.net] On Behalf Of
Darren Dale
Sent: Monday, January 09, 2006 12:33 PM
To: matplotlib-users@lists.sourceforge.net
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==None) or (pos>=len(self.seq)): return ''

pos = 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 = event.inaxes.format_coord(event.xdata, event.ydata)
  File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line
611, in format_coord
    xs = self.format_xdata(x)
  File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line
593, in format_xdata
    val = 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

-----Original Message-----
From: matplotlib-users-admin@lists.sourceforge.net
[mailto:matplotlib-users-admin@lists.sourceforge.net] On Behalf Of
Darren Dale
Sent: Monday, January 09, 2006 10:32 AM
To: matplotlib-users@lists.sourceforge.net
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 = setp(gca(), 'xticklabels', ['one', 'two', 'three', 'four'])

> set(labels, 'rotation', 'vertical')
> show()
>
>
> Once the plot is displayed, moving the mouse causes the following
> 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 = event.inaxes.format_coord(event.xdata, event.ydata)
> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line
> 611, in format_coord
> xs = self.format_xdata(x)
> File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line
> 593, in format_xdata
> val = 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
> idea on how I might be able to workaround this? I have seen posts
> 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
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:
            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=7637&alloc_id=16865&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
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
makes searching your log files as easy as surfing the web. DOWNLOAD

SPLUNK!

http://ads.osdn.com/?ad_idv37&alloc_id865&op=Click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
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

dd55@...163...
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=7637&alloc_id=16865&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users