OCaml plotting libraries

Continuing the discussion from [ANN] First release of OCaml bindings to the Polars dataframe library:

There’s also sanette/oplot: Mathematical plotting library for ocaml.

If you’re interested, I might polish and release (or upstream to PrintBox) a tiny utility for plotting in text (useful for expect tests or CLI interfaces).

opam search plot

returns a long list; some are libraries to help with ploting.

Wow, this looks quite useful! I think I’d definitely use it my libraries it if it were available on opam!


Other library:

ocaml-gr → It is a binding of a C-library which aims to be fast, and it is used in the Julia comunity as a backend of several more highlevel libraries.

ocaml-vega-lite → I guess it produces json documents to be plotted with vega-lite

I’m not an expert but in OCaml there are a bindings to Cairo library, which is widely used to build plotting libraries on top of it. Maybe something like ocaml-gg would be an alternative.


For those who want to try something new, I’ve found the following procedure to work:

opan pin gg --dev-repo
opam pin vg --dev-repo
opam pin https://github.com/dbuenzli/vz.git

then patch up

--- .opam/5.1.0/lib/vz/META.orig	2023-11-09 19:17:31.897443541 +0100
+++ .opam/5.1.0/lib/vz/META	2023-11-09 19:19:34.731868303 +0100
@@ -34,7 +34,7 @@
   description = "Quick cartesian plots of datasets"
   version = "0.0.0-35-g2667067"
   directory = "plot"
-  requires = "gg vg vz evidence"
+  requires = "gg vg vz vz.evidence"
   archive(byte) = "vz_plot.cma"
   archive(native) = "vz_plot.cmxa"
   plugin(byte) = "vz_plot.cma"
@@ -57,7 +57,7 @@
   description = "Evidence sample data"
   version = "0.0.0-35-g2667067"
   directory = "samples"
-  requires = "evidence"
+  requires = "vz.evidence"
   archive(byte) = "evidence_samples.cma"
   archive(native) = "evidence_samples.cmxa"
   plugin(byte) = "evidence_samples.cma"

and hunt for examples and docs at Vz / Erratique. I’m looking forward to stable release.