It is instructive to present a simple example that can be compiled and run from the command line. Although this example is specific to one installation, it should be fairly straightforward to adapt it to another installation. Toward that end, it is helpful to understand the PLplot lingo of "build directory" and "installation directory."
Here is a simple program that will generate a plot of part of a parabola.
open Plplot let simple_example () = let xs = Array.init 21 (fun xi -> float xi -. 10.0) in let ys = Array.map (fun x -> x**2.0) xs in plinit (); plenv (-10.0) 10.0 0.0 100.0 0 0; plline xs ys; plend (); () let () = simple_example ()
Next is a command line that will compile, bind, and link it. It requires that the OCaml findlib program is installed and in your $PATH and that the above code be saved as simple_example.ml
ocamlfind opt -package plplot -linkpkg -o simple_example simple_example.ml
The resulting binary program can be run by typing ./simple_example