add example documentation to the split axes
[PyX/mjg.git] / gallery / graphs / shift.py
blob62e1169bde0f831325f3960073f00c419ee1efb4
1 # You can manually set the subaxes and exceed the axes ranges.
2 # The width of the regular axes can be modified by a size paramater.
3 # While most axes do not have a size parameter, it can be added to
4 # any existing axis very easily. For linear axes so called sizedlinear
5 # and autosizedlinear axes are defined by PyX already.
6 #
7 # Note: The mytuple/lambda construct is currently a work-around to
8 # create tuples within the mathtree expression evaluator.
10 from pyx import *
12 subaxes = [graph.axis.linear(max=1),
13 graph.axis.linear(max=1),
14 graph.axis.sizedlinear(size=3, min=0, max=3)]
16 g = graph.graphxy(width=8, y=graph.axis.split(subaxes=subaxes))
17 g.plot([graph.data.file("shift.dat", x=1, y="mktuple(i, $(i+2))",
18 context={"mktuple": lambda x, y: (x, y), "i": i})
19 for i in range(3)], [graph.style.line()])
20 g.writeEPSfile("shift")
21 g.writePDFfile("shift")