plottah
An Erlang/LFE gnuplot process server
Table of Contents
↟
AboutThis library aims to provide a means for programmers of the BEAM VM to use gnuplot in their native language. To accomplish this, it runs gnuplot
in shell mode in a managed OS process. The erlexec
library is used for two-way communications (via stdin
and combined stdout
/stderr
).
This library is in the early stages of development, so to-date only a few functions are provided in the API. See the "Usage" section below for example usage (also the ./examples
directory). For now, the API is a very thin layer over the gnuplot shell, but in the future a DSL may be provided for a more functional programming language experience.
↟
BuildThis project depends upon:
- Erlang 21+
rebar3
-
gnuplot
being installed on the system
Note that development was done against the gnuplot installed by Homebrew on macos.
With the dependencies in place, the library may be compiled with the following:
rebar3 compile
↟
REPLTo start an interactive session in the LFE REPL:
make repl
and then:
(plottah:start)
This runs the gnuplot
shell in an OS process and allows for two-way communication. See below on how to communicate with the process.
↟
Testsrebar3 as test check
↟
ExamplesShow the list of examples:
rebar3 as examples list
Run a specific example:
rebar3 as examples lfe run -- 3d-hidden
↟
UsageFirst, be sure you've compiled the project using the instructions above!
Then start the REPL (see above), including starting up plottah
. You can then run code like the following in the REPL (example taken from here):
(defun options ()
#m(title "Hidden line removal of explicit surfaces"
style "increment default"
view "70, 45, 1, 1"
samples "20, 20"
isosamples "20, 20"
hidden3d "back offset 1 trianglepattern 3 undefined 1 altdiagonal bentover"
style "data lines"
xrange "[ -3.00000 : 3.00000 ] noreverse nowriteback"
x2range "[ * : * ] noreverse writeback"
yrange "[ -3.00000 : 3.00000 ] noreverse nowriteback"
y2range "[ * : * ] noreverse writeback"
zrange "[ * : * ] noreverse writeback"
cbrange "[ * : * ] noreverse writeback"
rrange "[ * : * ] noreverse writeback"))
(defun eqn ()
"sin(x*x + y*y) / (x*x + y*y)")
(plottah:splot (eqn) (options))
With that last, a window should pop up showing the following:
↟
LicenseApache License, Version 2.0
Copyright © 2023, Duncan McGreggor oubiwann@gmail.com.