Tuesday, May 19, 2009
Cl-2d is a two-dimensional graph library for Common Lisp. It builds on cl-cairo2 and thus uses the Cairo library, which provides various backends, including pixel-based (eg PNG, X11) and vector-based (PDF, SVG, PS) ones. It is meant solely for 2-dimensional plotting (hence the name). Cl-2d is available from Github. The license is LLGPL. Cl-2d is designed to be extensible instead of providing a plethora of "canned" functions - the latter of course exist, but the emphasis is on flexibility. Most plots used in scientific visualization are customized, and the purpose of this library is to make customization easy. Plotting happens on frames, which are rectangular areas. A DSL is available for splitting frames. A frame combined with a mapping from plot coordinates to Cairo coordinates is a drawing area. Functions named plot-* take a frame, set up and return a drawing area (on which you can continue drawing), while draw-* functions draw on an existing drawing area. This library is still under development, suggestions and contributions are welcome. I mean to clear up the axes code and add contour plots soon. See the example/ directory for a wide variety of examples. Some of the example plots, converted from PDF, are shown below.