Mathematical plotting library for ocaml
  • OCaml 92.9%
  • Perl 5.2%
  • Standard ML 1.1%
  • Shell 0.4%
  • Dune 0.3%
Find a file
2026-03-05 12:47:14 +01:00
.github/workflows workflow 2026-01-13 14:11:36 +01:00
bin fmt + toplevel test for CI 2026-01-13 13:35:32 +01:00
docs files 2026-03-05 12:47:14 +01:00
lib doc 2026-03-05 12:44:44 +01:00
share upgrade to SDL2 2022-11-23 08:47:55 +01:00
test doc 2026-01-13 13:51:11 +01:00
top fmt + toplevel test for CI 2026-01-13 13:35:32 +01:00
.ocamlformat fmt 2025-10-27 11:18:59 +01:00
CHANGELOG.md fmt + toplevel test for CI 2026-01-13 13:35:32 +01:00
dune-project add Path (connect lines) 2025-12-28 19:25:00 +01:00
LICENSE flip screenshot 2022-11-26 10:37:31 +01:00
make_doc.sh doc 2026-03-05 12:44:44 +01:00
oplot.opam add Path (connect lines) 2025-12-28 19:25:00 +01:00
README.md doc 2026-03-05 12:44:44 +01:00

Oplot

Mathematical plotting library for ocaml

2D plot and LaTeX 3D surface Isocurve
gamma surf3d isosurface
  • 2D plots

    • function y = f(x)
    • parametric curves
    • implicit curves f(x,y) = 0
    • can use mathematical functions from other libraries like gsl
    • can use LaTeX to display text and formulas
    • animations
    • Matrix or grid display
    • ...
  • 3D plots

    • parametric surfaces
    • 3D graphs z = f(x,y)
    • interactive 3D rotation and zoom
    • ...
  • Many renderers

    • GPU graphics (opengl/sdl)
    • Graphics package
    • high quality vector graphics in EPS or PDF files
    • xfig files
    • image screenshots

Documentation

Examples and API documentation.

GUI

An official standalone GUI for oplot.0.72: goplot

Examples

The top directory contains examples that can be run from the ocaml toplevel. See the README file.

Install version >= 0.80

The current version does not require lablgl, but uses instead tgls and gl-legacy. They will be automatically installed if you use opam install oplot.

If you need the newest versions:

opam install tgls
opam pin https://github.com/sanette/gl-legacy.git
opam pin https://github.com/sanette/oplot.git

On Windows, you may need to select these tsdl* versions:

opam pin https://github.com/sanette/tsdl
opam pin https://github.com/sanette/tsdl-ttf.git
opam pin https://github.com/sanette/tsdl-image.git
opam install oplot

Install v 0.72

  • oplot<0.80 requires lablgl. If you have any trouble with this, try this one.:
opam pin add https://github.com/sanette/lablgl-lib.git
opam install lablgl.1.07-lib
opam install oplot.0.72

Requirements

  • For PDF output you need to install the fig2dev system package.

  • For LaTeX display you need a working LaTeX installation; for instance install the texlive system package.

  • For using the Gnu Scientific Library, install the gsl opam package:

opam install gsl
  • For rendering via the OCaml Graphics library (currently not recommended), you need to use the oplot-graphics opam package.

Extensions to other backends

It's easy to add another backend by using the GRAPHICS signature, see https://github.com/sanette/oplot-graphics