prevent double call of _cleanup, which harms usefiles (and is a bad idea in general)
[PyX.git] / test / functional / test_graph3d.py
blob217d72862aeb9607a287a2998cff295ce1ceb7be
1 #!/usr/bin/env python
2 import sys; sys.path[:0] = ["../.."]
4 import math
5 from pyx import *
7 text.set(mode="latex")
9 def test_minimal(c, x, y):
10 g = c.insert(graph.graphxyz(x, y, size=3))
11 g.plot(graph.data.file("data/husimi_small.dat", x=1, y=2, z=3))
13 def test_line(c, x, y):
14 g = c.insert(graph.graphxyz(x, y, size=3))
15 g.plot(graph.data.file("data/husimi_small.dat", x=1, y=2, z=3), [graph.style.line()])
17 def test_grid(c, x, y):
18 g = c.insert(graph.graphxyz(x, y, size=3, x=graph.axis.lin(title="x axis"), y=graph.axis.lin(title="y axis"), z=graph.axis.lin(title="z axis")))
19 g.plot(graph.data.file("data/husimi_small.dat", x=1, y=2, z=3), [graph.style.grid()])
21 def test_surface(c, x, y):
22 g = c.insert(graph.graphxyz(x, y, size=3, x=graph.axis.lin(), y=graph.axis.lin(), x2=None, y2=None))
23 g.plot(graph.data.file("data/husimi_small.dat", x=1, y=2, z=3, color=4), [graph.style.surface()])
25 def test_surface2d(c, x, y):
26 g = c.insert(graph.graphxy(x, y, width=6, height=6))
27 g.plot(graph.data.file("data/husimi_small.dat", x=1, y=2, color=3), [graph.style.surface()])
29 c = canvas.canvas()
30 test_minimal(c, 0, 0)
31 test_line(c, 0, -8)
32 test_grid(c, 8, 0)
33 test_surface(c, 8, -8)
34 test_surface2d(c, -3, -20)
36 c.writeEPSfile("test_graph3d", page_paperformat=document.paperformat.A4)
37 c.writePDFfile("test_graph3d", page_paperformat=document.paperformat.A4)
38 c.writeSVGfile("test_graph3d", page_paperformat=document.paperformat.A4)