reduce length of pattern lines by one order of magnitude to prevent problems with...
[PyX/mjg.git] / examples / axis / rating.py
blob0d37faed4e846411c8c6f6de2ce45631bfe35215
1 # In the example below, several axes with the same parameters are
2 # plotted on a path scaled in 3 different sizes. Note that the axes
3 # adjust the ticks appropriately to the available space. The rating
4 # mechanism takes into account the number of ticks and subticks, but
5 # also the distances between the labels. Thus, the example in the
6 # middle has less ticks than the smallest version, because there is
7 # not enough room for labels with a decimal place.
9 # The rating mechanism is configurable and exchangeable by the axis
10 # keyword argument "rater". Instead of reconfiguring the rating
11 # mechanism, simple adjustments to favour more or less ticks are
12 # possible by the axis keyword argument "density".
14 from pyx import *
15 from pyx.graph import axis
17 p = path.curve(0, 0, 3, 0, 1, 4, 4, 4)
19 c = canvas.canvas()
20 c.insert(axis.pathaxis(p.transformed(trafo.translate(-4, 0).scaled(0.75)),
21 axis.linear(min=0, max=10)))
22 c.insert(axis.pathaxis(p, axis.linear(min=0, max=10)))
23 c.insert(axis.pathaxis(p.transformed(trafo.scale(1.25).translated(4, 0)),
24 axis.linear(min=0, max=10)))
25 c.writeEPSfile("rating")
26 c.writePDFfile("rating")