Controlling zorder of individual elements of the same type...

Hi all,

I am having a bit of a problem with the order things get drawn. I looked at the zorder example and the docs, but I can't seem to find a solution. Here's an illustration:

http://amath.colorado.edu/faculty/fperez/tmp/zorder_prob.png

The red wiggly line is drawn first, by a loglog() call, and then the green one is an axhline() call. However, the green line ends up below the red one. It turns out that in cases where the range of the red stuff is above the green cutoff, this causes the green line to be totally obscured. And for my plots, it's important that the green line is clearly visible always.

My naive expectation was that whatever was called last on the plot would end up on top, but that doesn't seem to be the case. I did a few experiments:

x=frange(0,2*pi,npts=100)
figure()
plot(x,sin(x),x,cos(x),linewidth=10)
plot(x,sin(2*x),linewidth=10)
axhline(0,linewidth=10)

And I can't really figure out what determines the zorder of all the line objects.

Is there a way to control this? Would it make sense to make the default behavior something more like what hand-drawing would cause? I mean: you draw on the canvas as if it were paper, and newly drawn lines appear on top of older ones.

Maybe there's a good reason for the current design, and I'm just missing the proper incantation. I'd be very grateful for a pointer in the right direction.

Cheers,

f