Hi,
using the PS Backend and matplotlib 0.82 with python 2.3.5 I have the
problem that my graphs typically show up on top of the axes lines (the
figure frame) and tick marks. However, for a journal quality figure, I
need the axes and the tick marks to be on top of the graph(s).
I looked through the archives and found below e-mail. Has there been
any progress in fixing this? Has Michael Brady submitted a patch?
Thanks.
- Christian
···
*****************************************************************
> I tried setting the z-order of the tick objects, but it
> looks to me like the ticks are hard-coded to always draw
> before (underneath) any lines or patches.
That"s right, they are. This is a bug and not a feature
The ticks are drawn as part of the Axis. See
matplotlib.axes.Axes.draw, eg
if self.axison:
self.xaxis.draw(renderer)
self.yaxis.draw(renderer)
The Axis instances (XAxis and YAxis) are comprised of Line2D (the
ticks) and Text (the labels) instances.
> Is there a way to tell the Axes to draw the ticks on top
> of any Polygons instead of underneath?
As noted above, before any of the zorder sorting is done, the xaxis
and yaxis are drawn. One possible solution is to move the axis
drawing commands to the
end of the Axes.draw function. Off the top of
my head, I don"t see any problem with this approach. Typically, you
want the ticks visible. We"ve talked in the past on the dev list
about the desirability in supporting ticking inside, center or outside
the axes box, but it hasn"t been implemented yet.
Vis-a-vis zorder sorting, a more general solution would be to have a
method which extracts the Artist primitives (Line2D and Text) from the
XAxis and YAxis and adds them to the sort, but I"m not sure if this is
actually better. In real life, I think you always want them on top.
Right?
> If not, it doesn"t look like it would be too hard to
> modify Axes.draw() to respect the z-order of ticks. I"m
> happy to do this, although I"m nervous that it might
> break stuff that assumes that ticks are always drawn
> before everything else. John, do you recommend that I
> create such a mod?
Yes, if you can find something that works, and behaves sanely over the
poorman"s unit tests in examples/backend_driver.py.
JDH