Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

d3lisp: A d3js interface for plotting on LISP

TL;DR

See the example gallery at https://rodrigozepeda.github.io/d3lisp/index.html#examples_for_getting_started .

Setup

d3lisp is a d3js interface for creating plots in ANSI Common LISP. To run it you need to:

  1. Download the project (either git clone https://github.com/RodrigoZepeda/d3lisp/ or click on Download button).
  2. Load the asdf package. See here for loading packages on SBCL for example.
(asdf:load-system :d3)
(use-package 'd3)

Currently d3lisp has been tested in the following LISP versions:

  1. SBCL

Example

The function for creating the plots is plot. Here, for example, we plot the exponential function:

(let* ((x (list 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5))
       (y (mapcar #'exp x)))
      (plot x y :title "Exponential"  :square-plot T  
                      :title-font-size 100 
                      :margin (list 10 10 10 10)
                      :padding (list 150 30 60 60) 
                      :x-label "x" :y-label "exp(x)" 
                      :interpolation "MonotoneX"
                      :file-name "MyFirstPlot"))

Which results in the following image:

The complete code example is as follows:

;;Set directory to functions
(asdf:load-system :d3)
(use-package 'd3)

;;Create plot
(let* ((x (list 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5))
       (y (mapcar #'exp x)))
      (plot x y :title "Exponential"  :square-plot T  
                      :title-font-size 100 
                      :margin (list 10 10 10 10)
                      :padding (list 150 30 60 60) 
                      :x-label "x" :y-label "exp(x)" 
                      :interpolation "MonotoneX"
                      :file-name "MyFirstPlot"))

The plot is saved to a file called MyFirstPlot.html in your current directory.

You can see additional examples on the example website .

License

The project is released under an MIT License.

Contributing

Feel free to contribute and discuss any changes you want to make. See the code of conduct here.

Releases

Packages

Contributors

Languages