Tuesday, September 6, 2011

Is anyone using cl-2d?

I wrote a Common Lisp plotting library called cl-2d in 2009, and I have been using it for my own graphs ever since. I am currently working on a library that implements the same functionality but with a much more friently interface and a different engine, using LaTeX and pgf to generate the plots instead of cairo. This gives me a lot of useful features out of the box, including very nicely formatted formulas if I want to use them in annotations, and it is reasonably fast for my purposes.

I plan to remove the existing cl-2d repository from Github, put up a new one (it is a complete rewrite from scratch, there isn't much sense in carrying around the old source), and recycle the name (for both the package and the library).

I don't think that there is anyone out there using the current version of this library, but in case you are, please let me know soon.


  1. I'm using it, and have found it very useful thanks to the flexible automatic layout. The fact it's powered by Cairo is also very handy, since I use it in a CL-GTK2 app.

    I'd very definitely want to see it stay, and in general I don't think it's a good idea to reuse prior names and remove old sources; it has bitten me more than once when people do that.

    PS. Since it doesn't seem I've ever got any reply, did you get my cl-cairo pull request on github?

  2. It is quite common for new "major versions" (e.g. version 1, version 2) to have significant breaking API changes. The question is how to represent this in CL packages/ASDF systems.

    I'd also suggest not totally blowing away the old source repos. Keeping them around is a cheap nod towards legacy support.

  3. Hi Tamas,

    i found your blog through the planet lisp meta blog and find it very interesting for a newbie hobby lisper like I am.

    I was looking for something like cl-2d before and I am really upset to have found it. But I am facing some problems using it. I have installed it using quicklisp on my system (OS X 10.6.8, sbcl 1.0.51) but if i try to load it:

    CL-USER(1): (asf:operate 'asdf:load-op :cl-2d)

    I am getting an error that libcairo isn't found on my system.

    Unable to load foreign library (LIBCAIRO).
    Error opening shared object "libcairo.dylib":
    dlopen(libcairo.dylib, 10): image not found.

    The library is installed in /usr/X11/lib/libcairo.dylib.

    I could not found any hints so far in the web. Could you point me in some direction for getting it to work?

    Thanks a lot

  4. Maciej, nuntius, and other who wrote in e-mail: I will leave cl-2d up as it is now, and pick a new name for the new library. However, I don't plan to develop cl-2d any further.

    Martin: all you need is CFFI to find the library. I don't know how to do that on a Mac, check the CFFI docs.

  5. Tamas,

    thanks a lot! I was fiddling around a lot with *foreign-library-directories* but was messing something up. After your comment I got things straight and now it works :-)


  6. Hi Tamas,
    First of all, thanks for your libs!

    I've been keeping cl-2d in mind for a while, should I want to plot anything in CL, but somehow didn't get to it.

    This post made me clone the cl-2d :) and quickload it to check out. Somehow cl-numlib needed in examples isn't in quicklisp, so I again had to postpone this acquaintance until later.

    Anyways, I'm looking forward for a new, improved 2D (or even 3D?) plotter for CL, something like matplotlib for python.