On Sun, Jul 27, 2008 at 3:57 PM, Ryan May <[EMAIL PROTECTED]> wrote: > Hi, > > Can anyone explain how the clipping code works? Or maybe how the backends > decide whether to draw a line? In working on drawing skewT's, I need > slanted gridlines. Through proper setting of transforms, I can get them to > draw slanted fine, but because they are slanted, the data x range at the top > of the plot is not equal to the data x range at the bottom.
The clipping code works as you would expect -- you pass it a path and the artist is clipped to that path. I think you are being bitten by something else (see below) > One issue that crops up as a result (which I've mentioned before) is that > the tickmarks at the top get drawn off past the right end of the plot > (enabling clipping of ticklines fixes this). Yes, you probably want to clip them > The second issue, which is the focus here, is that it seems impossible to > get matplotlib to draw any gridlines that start before the left side of the > chart. I can tweak Axis.draw() and get it to draw *all* the currently set > tick marks and I can disable clipping so that the gridlines draw past the > *right* side of the plot, but I can't seem to figure out how to draw a grid > lines that starts from off the left side. Look in the axis at the method: def draw(self, renderer): if not self.get_visible(): return renderer.open_group(self.__name__) midPoint = mtransforms.interval_contains(self.get_view_interval(), self.get_loc()) if midPoint: if self.gridOn: self.gridline.draw(renderer) if self.tick1On: self.tick1line.draw(renderer) if self.tick2On: self.tick2line.draw(renderer) The is midPoint is causing your troubles. Replace that with 'if 1 or midPoint' and your grids magically appear. You may want to insert some logic here so that custom classes can override this behavior. You mentioned you were using GTK -- clipping is not properly supported using the gdk renderer, so make sure you are using GTKAgg (or some other Agg variant) for your UI while testing clipping. JDH ------------------------------------------------------------------------- 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-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel