Hi,

I have a very vexing problem. I am using MPL (both 0.98.1 and 0.91.2)
to create a vertical stack of three plots with no space in between. In
order to do so, I need to eliminate either the top or bottom tick of
each plot. I have chosen to eliminate the top tick, and I am doing
something like the following:

ticks = a.yaxis.get_major_ticks()
ticks[-2].set_visible(False)

where a is the axis object in question. Most of the time, that works,
though I don't know why there is an additional "blank" tick inserted
at the top, making the top most visible tick the second to last
element in the ticks array.. However, sometimes, that deletes the
second tick from the top, leaving the top tick! An example of what I
am talking about can be found at
http://research.jsoishi.org/images/yavg_t_spectra.png. Note that all
of the plots are fine except for the bottom most subpanel of the upper
left plot. All subplots in that figure include exactly the two lines
above.

A simpler test case is the following:

---
#!/usr/bin/env python

import pylab as P
import numpy as N

x = N.linspace(0,2*N.pi,1000)
y1 = N.sin(x)
y2 = N.sinc(x)
y3 = N.cos(x)

fig = P.figure()


for i,y in enumerate([y1,y2,y3]):
    bot = 0.05+i*0.3
    ax = fig.add_axes([0.1,bot,0.8,0.3])
    ax.plot(x,y)


    ticks = ax.yaxis.get_major_ticks()
    ticks[-1].set_visible(False) # works on the top & bottom plot
#    ticks[-2].set_visible(False) # works on the middle one

    if i != 0:
        ax.set_xticklabels('')

fig.savefig('tick_test.png')

----

For me, the ticks[-1] line gives the image at
http://research.jsoishi.org/images/tick_test.png, while the commented
out ticks[-2] line gives the inverse (the middle plot deletes the top
most tick, and the others delete the second from the last).

Any help would be greatly appreciated.

Jeff

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to