some fixes from tests under various python versions
[PyX/mjg.git] / examples / graphs / manyaxes.py
blob2b959e12b89c3e4eaf817b678cabd2af1eec926d
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.logaxis(), y2=graph.linaxis(),
7 y3=graph.linaxis(min=0, max=1),
8 y4=graph.linaxis(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(data.data(d), x=0, y=1))
15 g.plot(graph.function("y2=f(x, 1)", context=locals()))
17 g.plot(graph.function("x=5+sin(2*pi*y3)"))
18 g.plot(graph.function("x=5+sin(2*pi*y4)"))
20 g.writetofile("manyaxes")