3d function plots
[PyX/mjg.git] / test / functional / test_graph3d.py
blob2bc0b470ea6d368662cd1cb7ea1f3c630e1bcd6f
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))
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()])
24 g.dodata()
26 def test_surface2d(c, x, y):
27 g = c.insert(graph.graphxy(x, y, width=6, height=6))
28 g.plot(graph.data.file("data/husimi_small.dat", x=1, y=2, color=3), [graph.style.surface()])
29 g.dodata()
31 c = canvas.canvas()
32 test_minimal(c, 0, 0)
33 test_line(c, 0, -8)
34 test_grid(c, 8, 0)
35 test_surface(c, 8, -8)
36 test_surface2d(c, -3, -20)
38 c.writeEPSfile("test_graph3d", paperformat=document.paperformat.A4)
39 c.writePDFfile("test_graph3d", paperformat=document.paperformat.A4)