Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/c-cube/ocaml-gnuplot
bindings to gnuplot (fork of https://bitbucket.org/ogu/gnuplot-ocaml/)
https://github.com/c-cube/ocaml-gnuplot
gnuplot ocaml plot
Last synced: 3 months ago
JSON representation
bindings to gnuplot (fork of https://bitbucket.org/ogu/gnuplot-ocaml/)
- Host: GitHub
- URL: https://github.com/c-cube/ocaml-gnuplot
- Owner: c-cube
- License: other
- Created: 2019-12-17T04:34:08.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-05-06T16:29:36.000Z (9 months ago)
- Last Synced: 2024-10-13T01:46:09.716Z (3 months ago)
- Topics: gnuplot, ocaml, plot
- Language: OCaml
- Homepage: https://c-cube.github.io/ocaml-gnuplot/
- Size: 3.22 MB
- Stars: 13
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Gnuplot-OCaml - Simple interface to Gnuplot [![Build status](https://github.com/c-cube/ocaml-gnuplot/actions/workflows/main.yml/badge.svg)](https://github.com/c-cube/ocaml-gnuplot/actions/workflows/main.yml)
---------------------------------------------------------------------------
Ocaml-Gnuplot provides a simple interface to [Gnuplot](http://www.gnuplot.info)
from [OCaml](http://www.ocaml.org). The API supports only 2D graphs and was
inspired by [FnuPlot](https://github.com/fsprojects/FnuPlot).This is the continuation of https://bitbucket.org/ogu/gnuplot-ocaml/ . Changes mainly
include API changes that are friendlier
with `module Gp = Gnuplot` (as opposed to `open Gnuplot`),
moving to `dune` for the build, and removing Core as a dependency.## Installation
From [OPAM](http://opam.ocaml.org)
$ opam install gnuplot
From Source
$ make
$ make install**NOTE**: For a persistent X11 terminal add `set term x11 persist` to your
`.gnuplot` file in your home directory.## Usage
### Documentation
The API-documentation of this distribution can be built with `make doc`.
It can also be found [online](https://c-cube.github.io/ocaml-gnuplot/).### Examples
This simple example
```ocaml
module Gp = Gnuplotlet () =
let gp = Gp.create () in
Gp.plot_many gp ~range:(Gp.Range.XY (-10., 10., -1.5, 1.5))
[ Gp.Series.lines_func "sin(x)" ~title:"Plot a line" ~color:`Blue
; Gp.Series.points_func "cos(x)" ~title:"Plot points" ~color:`Green ];
Gp.close gp
```generates the following plot:
![Simple Plot](./assets/simple_plot.png)
For more examples please refer to the `examples`-directory of this
distribution. You can build the examples with dune, e.g.```
$ dune build examples/gbm_paths.exe
```Running
```
$ dune exec examples/gbm_paths.exe
```displays 10 simulated paths of geometric Brownian motion:
![GBM Paths](./assets/gbm_paths.png)