File: test_graph3d.py

package info (click to toggle)
pyx3 0.17-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,328 kB
  • sloc: python: 27,656; makefile: 225; ansic: 130; sh: 17
file content (39 lines) | stat: -rwxr-xr-x 1,459 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
import sys; sys.path[:0] = ["../.."]

import math
from pyx import *

text.set(text.LatexEngine)

def test_minimal(c, x, y):
    g = c.insert(graph.graphxyz(x, y, size=3))
    g.plot(graph.data.file("data/husimi_small.dat", x=1, y=2, z=3))

def test_line(c, x, y):
    g = c.insert(graph.graphxyz(x, y, size=3))
    g.plot(graph.data.file("data/husimi_small.dat", x=1, y=2, z=3), [graph.style.line()])

def test_grid(c, x, y):
    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")))
    g.plot(graph.data.file("data/husimi_small.dat", x=1, y=2, z=3), [graph.style.grid()])

def test_surface(c, x, y):
    g = c.insert(graph.graphxyz(x, y, size=3, x=graph.axis.lin(), y=graph.axis.lin(), x2=None, y2=None))
    g.plot(graph.data.file("data/husimi_small.dat", x=1, y=2, z=3, color=4), [graph.style.surface()])

def test_surface2d(c, x, y):
    g = c.insert(graph.graphxy(x, y, width=6, height=6))
    g.plot(graph.data.file("data/husimi_small.dat", x=1, y=2, color=3), [graph.style.surface()])

c = canvas.canvas()
test_minimal(c, 0, 0)
test_line(c, 0, -8)
test_grid(c, 8, 0)
test_surface(c, 8, -8)
test_surface2d(c, -3, -20)

c.writeEPSfile("test_graph3d", page_paperformat=document.paperformat.A4)
c.writePDFfile("test_graph3d", page_paperformat=document.paperformat.A4)
c.writeSVGfile("test_graph3d", page_paperformat=document.paperformat.A4)