2 import sys
; sys
.path
[:0] = ["../.."]
6 from pyx
import mathtree
, attr
10 def test_bar(c
, x
, y
):
11 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)]))))
12 g
.plot(graph
.data
.file("data/testdata2", xname
=1, y
=2, text
=2), [graph
.style
.barpos(fromvalue
=0), graph
.style
.bar(), graph
.style
.text()])
14 def test_bar2(c
, x
, y
):
15 g
= c
.insert(graph
.graphxy(x
, y
, height
=5, width
=5, y
=graph
.axis
.bar(title
="Month")))
16 g
.plot(graph
.data
.file("data/testdata2", x
=2, dx
="1", yname
=1), [graph
.style
.bar(), graph
.style
.errorbar()])
18 def test_bar3(c
, x
, y
):
19 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))))
20 g
.plot([graph
.data
.file("data/testdata2", xname
=1, y
=2),
21 graph
.data
.file("data/testdata2", xname
=1, y
=3),
22 graph
.data
.file("data/testdata2", xname
=1, y
=3)], [graph
.style
.bar()])
24 def test_bar4(c
, x
, y
):
25 g
= c
.insert(graph
.graphxy(x
, y
, height
=5, width
=12, x
=graph
.axis
.bar(graph
.axis
.bar(dist
=0)), key
=graph
.key
.key()))
26 g
.plot([graph
.data
.file("data/testdata2", xname
=0, y
=2, ystack1
=3),
27 graph
.data
.file("data/testdata2", xname
=0, y
="$2-1", ystack1
=3, title
="test")],
28 [graph
.style
.bar(), graph
.style
.stackedbarpos("ystack1"), graph
.style
.bar([color
.palette
.ReverseRainbow
]), graph
.style
.symbol()])
35 c
.writeEPSfile("test_bargraph", paperformat
="a4")