Skip to content
/ cl-plot Public

Thin Common Lisp wrapper for gnuplot. Also check out the incudine-plot repo here.

Notifications You must be signed in to change notification settings

ormf/cl-plot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cl-plot

License

**********************************************************************

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.

**********************************************************************

Overview

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.

INSTALLATION

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> 

Plotting Data Lists

;;; 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)))

Plotting Arrays

(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)))

Plotting Functions

(plot #'sin :region `(0 ,(* 2 pi)))

(plot #'exp :region `(0 4))

;; default region is '(0 1)

(plot #'sin)

About

Thin Common Lisp wrapper for gnuplot. Also check out the incudine-plot repo here.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published