Hi all,

I have a question about zorder and Axis elements. I read in the thread titled "zorder not working for grid lines??" that since grid lines are Axis elements, they don't respect the zorder. It's possible to set grid lines below other plot elements with Axis.set_axisbelow(). However, I have a case where I want grid lines to be below my plot elements, but I want the ticks to be above them (test code attached). As it stands, they can be either both below or both above.

Has anyone found a way around this limitation? Is having zorder apply to Axis elements on the wishlist?

Thanks for any info,
Mike

from pylab import *

# setup a simple plot
rcParams['xtick.major.size'] = 12
rcParams['ytick.major.size'] = 12
x = arange(5)
plot(x,x,'g',zorder=4)
ax = gca()

# add a rectangle that extends to the right edge
ax.add_patch(matplotlib.patches.Rectangle((1.75,1.75), 5, 1.5, fill=True, zorder=2))

# put grid lines behind rectangle
ax.grid(True)
gridlines = ax.get_xgridlines()+ax.get_ygridlines()
setp(gridlines, 'zorder', 1)

# put tick lines above rectangle
ticklines = ax.get_lines()+ax.get_xticklines()+ax.get_yticklines()
setp(ticklines, 'zorder', 3)

show()


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to