2 import sys
; sys
.path
[:0] = ["../.."]
8 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)]))))
9 g
.plot(graph
.data
.file("data/testdata2", xname
=1, y
=2, text
=2), [graph
.style
.barpos(fromvalue
=0), graph
.style
.bar(), graph
.style
.text()])
11 def test_bar2(c
, x
, y
):
12 g
= c
.insert(graph
.graphxy(x
, y
, height
=5, width
=5, y
=graph
.axis
.bar(title
="Month")))
13 g
.plot(graph
.data
.file("data/testdata2", x
=2, dx
="1", yname
=1), [graph
.style
.bar(), graph
.style
.errorbar()])
15 def test_bar3(c
, x
, y
):
16 g
= c
.insert(graph
.graphxy(x
, y
, height
=5, width
=12, x
=graph
.axis
.nestedbar(painter
=graph
.axis
.painter
.bar(innerticklength
=0.2)), key
=graph
.key
.key()))
17 g
.plot([graph
.data
.file("data/testdata2", xname
="$1, 0", y
=2),
18 graph
.data
.file("data/testdata2", xname
="$1, 1", y
=3),
19 graph
.data
.file("data/testdata2", xname
="$1, 2", y
=3, title
=None)], [graph
.style
.bar()])
21 def test_bar4(c
, x
, y
):
22 subbarwithtext
= graph
.axis
.bar(dist
=0,
23 painter
=graph
.axis
.painter
.bar(basepathattrs
=None),
24 linkpainter
=graph
.axis
.painter
.bar(basepathattrs
=None))
25 g
= c
.insert(graph
.graphxy(x
, y
, height
=5, width
=12,
26 x
=graph
.axis
.nestedbar(defaultsubaxis
=graph
.axis
.bar(subaxes
={'A': graph
.axis
.lin(painter
=None, linkpainter
=None, parter
=None),
27 'B': graph
.axis
.bar(painter
=graph
.axis
.painter
.bar(basepathattrs
=None),
28 linkpainter
=graph
.axis
.painter
.bar(basepathattrs
=None))},
29 painter
=graph
.axis
.painter
.bar(basepathattrs
=None),
30 linkpainter
=graph
.axis
.painter
.bar(basepathattrs
=None))),
32 g
.plot([graph
.data
.data(graph
.data
.points([['x', 1, 12], ['y', 2, 11], ['z', 3, 10]], id=1, y
=2, ystack1
=3, title
="test"), xname
="id, 'A'"),
33 graph
.data
.data(graph
.data
.points([['x', 4, 9], ['y', 5, 8], ['z', 6, 7]], id=1, y
=2, ystack1
=3, title
="test"), xname
="id, ('B', 'X')"),
34 graph
.data
.data(graph
.data
.points([['x', 7, 6], ['y', 8, 5], ['z', 9, 4]], id=1, y
=2, ystack1
=3, title
="test"), xname
="id, ('B', 'Y')"),
35 graph
.data
.data(graph
.data
.points([['x', 10, 3], ['y', 11, 2], ['z', 12, 1]], id=1, y
=2, ystack1
=3, title
="test"), xname
="id, ('B', 'Z')")],
36 [graph
.style
.barpos(fromvalue
=0), graph
.style
.bar(), graph
.style
.stackedbarpos("ystack1", addontop
=1), graph
.style
.bar([color
.gradient
.ReverseRainbow
])])
38 def test_bar5(c
, x
, y
):
39 g
= c
.insert(graph
.graphxyz(x
, y
, size
=3, x
=graph
.axis
.bar(), y
=graph
.axis
.bar(), z
=graph
.axis
.lin()))
40 g
.plot(graph
.data
.data(graph
.data
.points([[1, 1, 1.4], [1, 2, 1.8], [2, 1, -0.5], [2, 2, 0.9]]), xname
=1, yname
=2, z
=3),
41 [graph
.style
.barpos(fromvalue
=0, frompathattrs
=None), graph
.style
.bar(barattrs
=[style
.linejoin
.bevel
])])
49 c
.writeEPSfile("test_bargraph", page_paperformat
=document
.paperformat
.A4
)
50 c
.writePDFfile("test_bargraph", page_paperformat
=document
.paperformat
.A4
)
51 c
.writeSVGfile("test_bargraph", page_paperformat
=document
.paperformat
.A4
)