PyX — Example: splitgraphs/

0.3 KB
10.2 KB
51.7 KB
25.7 KB

Split axis at certain values

from pyx import *

pf =

g = graph.graphxy(width=8, x=graph.axis.split())
g.plot(pf("k", -1, 1,
          "x, y = splitatvalue(k, -0.9, 0.9), k**100",


A typical use-case for a split axis is to use some special positions on the axis to mark the axis breaks. For that the splitatvalue function is available in all places, where expressions are evaluated in the classes. Here we create a special parametric function where split positions for the x axis are added by the splitatvalue function and the y function is a simple polynomial of high order. Note that you can set several split positions by additional parameters of the splitatvalue function. In that case the splitatvalue function marks odd regions to be a "None", by which those data values are ignored by the splitaxis instance.