From: André W. <wo...@us...> - 2015-12-03 23:33:23
|
Dear Michael, thanks for your patch, I queue the issue for fixing in the next release. We will probably do it differently, though. I have another report here (maybe it is some internal communication), that we want the grid to "live" on a separate layer altogether. For example on a bar graph you might want to have the axis on top of the data but the grid below the data (the bars in this case). This is rather common. At the moment we cannot easily do that, we should completely separate the grid from the axis (make it a separate "first-level" layer), which will probably make a fix to the issue you came up with much easier to fix ... Best, André Am 02.12.2015 um 12:21 schrieb Michael J Gruber <mic...@us...>: > "?axisat" allow shifting the axes to other locations, e.g. the quite > common case of having the axes go through 0. This is implemented by > shifting all axis layers, which includes the grid layer, so that it gets > placed outside of the graph. > > Omit the grid layer when shifting around axis layers so that the grid > remains in place. > > Signed-off-by: Michael J Gruber <mic...@us...> > --- > > Notes: > The patch is against r3425, sorry for not being on py 3 yet. > > Simple reproducer: > > from pyx import * > > gridpainter = graph.axis.painter.regular(gridattrs=[]) > gridaxis = graph.axis.linear(painter=gridpainter) > g=graph.graphxy(width=6, x=gridaxis, y=gridaxis, xaxisat=0, yaxisat=0) > g.plot(graph.data.function("y(x)=x*x", min=-1, max=1)) > g.writePDFfile() > > pyx/graph/graph.py | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/pyx/graph/graph.py b/pyx/graph/graph.py > index 5584530..9e3c558 100644 > --- a/pyx/graph/graph.py > +++ b/pyx/graph/graph.py > @@ -535,7 +535,10 @@ class graphxy(graph): > t = trafo.translate_pt(0, self.ypos_pt + v*self.height_pt - axis.positioner.y1_pt) > c = canvas.canvas() > for layer, subcanvas in axis.canvas.layers.items(): > - c.layer(layer).insert(subcanvas, [t]) > + if layer == 'grid': > + c.layer(layer).insert(subcanvas) > + else: > + c.layer(layer).insert(subcanvas, [t]) > assert len(axis.canvas.layers) == len(axis.canvas.items), str(axis.canvas.items) > axis.canvas = c > > -- > 2.6.3.507.gca54332 > > > ------------------------------------------------------------------------------ > Go from Idea to Many App Stores Faster with Intel(R) XDK > Give your users amazing mobile app experiences with Intel(R) XDK. > Use one codebase in this all-in-one HTML5 development environment. > Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. > http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 > _______________________________________________ > PyX-devel mailing list > PyX...@li... > https://lists.sourceforge.net/lists/listinfo/pyx-devel -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ |