********************************************************************** Copyright (c) 2018 Orm Finnendahl <[email protected]> Revision history: See git repository. This program is free software; you can redistribute it and/or modify it under the terms of the Gnu Public License, version 2 or later. See https://www.gnu.org/licenses/gpl-2.0.html for the text of this agreement. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. **********************************************************************
cl-plot is a thin Common Lisp Wrapper for gnuplot It expects
gnuplot at /usr/bin/gnuplot (change to your needs using the
variable *GNUPLOT-COMMAND*
).
The central function is plot
, which at this point accepts lists,
one-dimensional arrays or functions. plot
is implemented as a
generic function so that it can be specialized on different data
types and easily extended (see for example the incudine-plot
package on this github account which is used for visualising
musical data like envelopes or buffers).
The plot
function returns its argument unchanged. This enables to
wrap the (plot …) form around suitable subexpressions within code
to graphically monitor intermediate results of larger code blocks
without changing the overall outcome of the code.
cl-plot depends on uiop.
The recommended way is to use quicklisp and put the cl-plot folder into <user-home-dir>/quicklisp/local-projects/.
Then load it with
CL-USER> (ql:quickload "cl-plot")
To load "cl-plot":
Load 1 ASDF system:
cl-plot
; Loading "cl-plot"
.
("cl-plot")
CL-USER> (in-package :cl-plot)
#<PACKAGE "CL-PLOT">
CL-PLOT>
;;; 2-dimensional:
(plot
(loop for count below 20
collect (list count (random 40.0)))
:grid nil)
;;; 1-dimensional:
(plot
(loop for count below 20
collect (random 40.0)))
(plot #(3 1 8 6 5 2 4))
(plot #((0 3) (1 1) (2 8) (3 6) (4 5) (5 2) (6 4)))
(plot #(#(0 3) #(1 1) #(2 8) #(3 6) #(4 5) #(5 2) #(6 4)))
(plot #'sin :region `(0 ,(* 2 pi)))
(plot #'exp :region `(0 4))
;; default region is '(0 1)
(plot #'sin)