- adjustments to the new path + graph data and style handling
[PyX/mjg.git] / examples / graphs / manyaxes.py
blob50b582e7d9b4857e6d7de465eab6fc5addf52c07
1 import math, random
2 from pyx import *
4 # a xy-graph has linear x and y axes by default
5 # they might be overwritten and futher axes might be added as well
6 g = graph.graphxy(width=8, y=graph.axis.log(), y2=graph.axis.lin(),
7 y3=graph.axis.lin(min=0, max=1),
8 y4=graph.axis.lin(min=0, max=2))
10 # we generate some data and a function with multiple arguments
11 d = [[i, math.exp(0.8*i+random.random())] for i in range(1,10)]
12 f = lambda x, a: x*a
14 g.plot(graph.data.list(d, x=1, y=2))
15 g.plot(graph.data.function("y2=f(x, 1)", context=locals()))
17 g.plot(graph.data.function("x=5+sin(2*pi*y3)"))
18 g.plot(graph.data.function("x=5+sin(2*pi*y4)"))
20 g.writeEPSfile("manyaxes")