Plotting in Lisp, Part III

I’m settling down on an interface, here, and have decided that the best thing to do is to make it as much a Lisp-ified version of the standard gnuplot interface as possible. So here’s what I’m thinking now:

; make data series
(defparameter series1 (make-series-2d '((1 2) (2 3) (3 5) (4 7) (5 11) (6 13) (7 17))))
(defparameter series2 (make-series-2d '((0) (1) (1) (2) (3) (5) (8) (13) (21))))

Then make a plot - no 2d specified, because we’ll use ’splot’ if we ever do 3d (just like gnuplot):

; make a plot
(defparameter plot (make-plot))

Add the data series, possibly with series-specific options:

; add the series to the plot
; would it be better to use symbols than strings?
(plot-add-series plot series1 :title "Primes" :style "linespoints" :axes "x1y1")
(plot-add-series plot series2 :title "Fibonacci" :style "points" :axes "x2y2")

Show the plot:

; draw the plot
(plot-draw plot)

Close it when we’re done:

; make sure to close the plot
(plot-close plot)

2 Responses to “Plotting in Lisp, Part III”

  1. Anonymous

    Inheritable titles?

    A series of plots which use the same x, y data lines, it would be a drag to name the title everytime, wouldn’t it?

    default would be to use the title as defined at the top of code
    specific “title:” references will override the default

    Other things which crop up off the top of my head….

    a) ways to squish/scale multiple plots to together.
    b) ways to read existing data files?
    c) emacs skeleton types(equivalent) to generate simple cases of lisp code for plotting.
    d) a default config file where default values can be read much like a .emacs file.

  2. Robert Goldman

    One minor suggestion: perhaps you should aviod making the option arguments (e.g., “linespoints”) be strings. If you do, then you can’t do nice (eql ‘foo) type dispatch in the methods, I believe. I think that might make writing methods somewhat less pleasant than if the option arguments are of some type that supports EQL-testing.

Leave a Reply

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

You must read and type the 5 chars within 0..9 and A..F, and submit the form.

  

Oh no, I cannot read this. Please, generate a