Oplot is an OCaml library for mathematical plotting using OpenGL graphics.
oplot-graphics
is a plugin for extending Oplot. It will enable the
use of the X11 graphics library (unix) or the Win32 API (Windows)
through the Graphics ocaml
library.
Currently oplot-graphics
is not that useful because only a subset of
Oplot is implemented. Moreover the output quality of the Graphics
library is debatable. The original Oplot library should be better for
most users.
Install the library:
opam pin https://github.com/sanette/oplot-graphics.git
Then in ocaml
files just use the alias
module Oplot = Oplot_graphics
and then use Oplot as usual. The x11
device must be explicitly
selected, for instance:
module Oplot = Oplot_graphics
open Oplot.Plt
let p = plot sin (-2.) 20.
let a = axis 0. 0.;;
display ~dev:x11 [ Color red; p; Color black; a ];;
See the test
directory.
oplot-graphics
can also be used from the toplevel. After starting
the toplevel (ocaml
or utop
), just load the library with
#use "topfind";;
#thread;;
#require "oplot-graphics";;
You may then copy/paste the example above.