File: join.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 (24 lines) | stat: -rwxr-xr-x 679 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/python3

from pyx import *

g = graph.graphxy(width=8, key=graph.key.key())

As = [0.3, 0.6, 0.9]

d = [graph.data.join([graph.data.function("y_a(x_a)=A*sin(2*pi*x_a)", context=dict(A=A)),
                      graph.data.file("join.dat", x_b=1, y_b=i+2)],
                     title=r"$A=%g$" % A)
     for i, A in enumerate(As)]

attrs = [color.gradient.RedBlue]

g.plot(d,
       [graph.style.pos(usenames=dict(x="x_a", y="y_a")),
        graph.style.line(attrs),
        graph.style.pos(usenames=dict(x="x_b", y="y_b")),
        graph.style.symbol(graph.style.symbol.changesquare, symbolattrs=attrs, size=0.1)])

g.writeEPSfile()
g.writePDFfile()
g.writeSVGfile()