- adjustments to the new graph data+style handling
[PyX/mjg.git] / test / functional / test_bargraph.py
blobaeb63c04e1c7c361edef89209238d0567c1450aa
1 #!/usr/bin/env python
2 import sys; sys.path[:0] = ["../.."]
4 import math
5 from pyx import *
6 from pyx import mathtree, attr
8 def test_bar(c, x, y):
9 g = c.insert(graph.graphxy(x, y, height=5, width=5, x=graph.axis.bar(title="Month", painter=graph.axis.painter.bar(nameattrs=[text.halign.right, trafo.rotate(90)]))))
10 g.plot(graph.data.file("data/testdata2", xname=1, y=2, text=2), [graph.style.barpos(fromvalue=0), graph.style.bar(), graph.style.text()])
12 def test_bar2(c, x, y):
13 g = c.insert(graph.graphxy(x, y, height=5, width=5, y=graph.axis.bar(title="Month")))
14 g.plot(graph.data.file("data/testdata2", x=2, dx="1", yname=1), [graph.style.bar(), graph.style.errorbar()])
16 def test_bar3(c, x, y):
17 g = c.insert(graph.graphxy(x, y, height=5, width=12, x=graph.axis.bar(multisubaxis=graph.axis.bar(dist=0), painter=graph.axis.painter.bar(innerticklength=0.2)), key=graph.key.key()))
18 g.plot([graph.data.file("data/testdata2", xname=1, y=2),
19 graph.data.file("data/testdata2", xname=1, y=3),
20 graph.data.file("data/testdata2", xname=1, y=3, title=None)], [graph.style.bar()])
22 def test_bar4(c, x, y):
23 g = c.insert(graph.graphxy(x, y, height=5, width=12, x=graph.axis.bar(graph.axis.bar(dist=0)), key=graph.key.key()))
24 g.plot([graph.data.file("data/testdata2", xname=0, y=2, ystack1=3, title="test"),
25 graph.data.file("data/testdata2", xname=0, y="$2-1", ystack1=3)],
26 [graph.style.bar(), graph.style.stackedbarpos("ystack1"), graph.style.bar([color.palette.ReverseRainbow])])
28 c = canvas.canvas()
29 #test_bar(c, 0, 0)
30 #test_bar2(c, 7, 0)
31 #test_bar3(c, 0, -7)
32 test_bar4(c, 0, -14)
33 c.writeEPSfile("test_bargraph", paperformat="a4")