In July 2011 I moved to Harvard University to join the School of Engineering and Applied Sciences. My new web page is here.

I don't really maintain this code any more, but people seem to periodically find it useful. It is meant to be a lisp interface to gnuplot. It is likely that there are better tools out there for this sort of thing by now. Also, it is probably only going to work on a Linux-type system.

There are two test functions in the code, to give you an idea of what's going on.

(defun test-plot ()
  (let ((series1
         (make-series-2d '((5 1) (6 -2) (7 4) (8 -8) (9 16) (12 -32))))
        (series2
         (make-series-2d '((5) (6) (8) (2) (3) (8))))
        (series3
         (make-series-2d
          '((1 2) (2 3) (3 5) (4 7) (5 11) (6 13) (7 17))))
        (plot (make-plot)))
    (plot-add-series plot series1
                     :style  "linespoints"
                     :title  "Foo"
                     :axes   "x2y1")
    (plot-add-series plot series2
                     :style  "lines"
                     :title  "Bar"
                     :smooth "bezier"
                     :axes   "x2y1")
    (plot-add-series plot series3
                     :style  "points"
                     :title  "Primes"
                     :axes   "x1y2")

    (plot-title plot "Test Title")
    (plot-xlabel plot "X1 Label")
    (plot-x2label plot "X2 Label")
    (plot-ylabel plot "Y1 Label")
    (plot-y2label plot "Y2 Label")

    (plot-cmd plot "set logscale y")

    (plot-draw plot)

    (break "Write postscript file?")
    (plot-close plot)))

(defun test-animation ()
  (let ((plot (make-plot)))

    ; Start each frame at a different spot
    (dotimes (count 1000)
      (let ((start (* 0.1 count))
            (data ()))

        ; Generate each data point
        (dotimes (len 100)
          (push (list (sin (+ start (* len 0.1)))) data))

        ; Make the series
        (let ((series (make-series-2d data)))
          (plot-add-series plot series :style "lines")
          (plot-draw plot)
          (plot-remove-series plot series))
        (sleep 0.05)))
    (break "Close gnuplot?")
    (plot-close plot)))

download cl-gnuplot.lisp