Closed sphh closed 4 years ago
You need to pass the painter to the axis. Also, changeable attributes are meant to replace a single attribute, the term list in changelist
in related to the list it selects from, but it still is a single attribute. It is attr.changelist
, not attrs.changelist
. Fortunately, it is enough to replace one of the attributes in the gridattrs list by None
to suppress printing of this tick level grid lines. This means you could also keep the linestyle dashed, but make the linewidth None
. Should give the very same result (haven't tested, though).
Here is a full example based on the function example from the PyX website:
from pyx import *
myaxispainter = graph.axis.painter.regular(
gridattrs=[attr.changelist([style.linestyle.dashed,
None]),
style.linewidth.THIn])
g = graph.graphxy(width=8,
x=graph.axis.linear(min=-15,
max=15,
painter=myaxispainter))
g.plot(graph.data.function("y(x)=sin(x)/x"))
g.writePDFfile()
(We know the notation is very verbose. We plan to make setting attributes available to constructors upper in the hirachie, so you could set x_painter_gridattrs
in the graph constructor. It is our long term perspective while keeping the internal structure, just making it way more easy to access.)
Aha, I see. Thanks for your help!!
Is it possible to change the
linewidth
and thelinestyle
of grid lines?My naïve approach does not work
Thanks for your help and your great package!!!