From: John H. <jdh...@ac...> - 2005-04-14 03:16:35
|
>>>>> "Michael" == Michael Brady <mb...@jp...> writes: Michael> I tried setting the z-order of the tick objects, but it Michael> looks to me like the ticks are hard-coded to always draw Michael> 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. Michael> Is there a way to tell the Axes to draw the ticks on top Michael> 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? Michael> If not, it doesn't look like it would be too hard to Michael> modify Axes.draw() to respect the z-order of ticks. I'm Michael> happy to do this, although I'm nervous that it might Michael> break stuff that assumes that ticks are always drawn Michael> before everything else. John, do you recommend that I Michael> 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 |