34 import math, subprocess, sys
48 pipe.write(
"plot [0:1] %f + %f * t, %f + %f * t notitle\n" % (
49 x1, x2 - x1, y1, y2 - y1))
53 global x, y, direction, pendown
75 direction += math.pi / 180. * degrees
76 return direction * 180. / math.pi
80 newX = x + length * math.cos(direction)
81 newY = y + length * math.sin(direction)
90 if __name__ ==
'__main__':
91 p = subprocess.Popen([
'gnuplot'], stdin = subprocess.PIPE)
94 pipe.write(
"set multiplot\n")
95 pipe.write(
"set parametric\n")
96 pipe.write(
"set xrange [-%d:%d]\n" % (WIDTH, WIDTH))
97 pipe.write(
"set yrange [-%d:%d]\n" % (HEIGHT, HEIGHT))
98 pipe.write(
"set size ratio -1\n")
99 pipe.write(
"unset xtics\n")
100 pipe.write(
"unset ytics\n")
Embedding a Guile interpreter.
def load
Load a file and evaluate its contents in the top-level environment.
def define
Create a top level variable.