Module type Gp.Plot

Contains all the commands you need to draw your figure

val ex : string -> unit

Executes an arbitrary gnuplot command.

val plot : ?using:string -> ?axes:string -> ?legend:string -> ?style:string -> data -> property list -> unit

Invoke gnuplot's plot command on some data.

  • parameter using

    In standard gnuplot format, e.g. "1:3" to plot the 3rd column against the 1st. Defaults to "0:1" if the data is a single column vector, and to "1:2" if the data has at least two columns.

  • parameter axes

    In standard gnuplot format, e.g. "x1y2" for primary x-axis and secondary y-axis. Defaults to "x1y1". Example:

    plot (A Mat.(uniform 10 3)) ~using:"1:3" ~style:"lp pt 7 lc 8" [ ... properties ... ]
val plots : item list -> property list -> unit

Invoke gnuplot's plot command on a whole list of data items. Example:

plots [ item (A Mat.(uniform 10 2)) ~style:"p pt 7 lc 7";
        item (F "cos(x)") ~style:"l lc rgb 'red'" ] [ ...properties... ]
val splot : ?using:string -> ?axes:string -> ?legend:string -> ?style:string -> data -> property list -> unit

Same as plot, for 3D plots.

val splots : item list -> property list -> unit

Same as plots, for 3D plots.

val heatmap : ?style:string -> [ `grid of Owl.Mat.mat * Owl.Mat.mat * Owl.Mat.mat | `mat of Owl.Mat.mat ] -> property list -> unit
val load : string -> unit
val multiplot : ?rect:((float * float) * (float * float)) -> ?spacing:(float * float) -> (int * int) -> (margins:property -> int -> int -> int -> unit) -> unit

multiplot ?rect ?spacing (rows, cols) f automatically sets the plot margins for a (rows x cols) tile, and populates the tile by calling f plot_id row_id col_id (where plot_id = row_id * cols + col_id, ie the function completes the first row first, then the second row, etc. You can specify where to position the tile by setting ?rect to the (screen) coordinates of any two opposite corners (default: ((0.1, 0.1), (0.9, 0.9)) i.e. 10% padding on all sides). You can also adjust the horizontal and vertical spacing between vignettes by setting ?spacing (default: (0.04, 0.04) in screen coordinates).

Example:

let data = Mat.gaussian 20 12 (* 12 = 4x3 *)
let figure (module P: Plot) =
  P.multiplot (4, 3) (fun k row col ->
    P.plot (A Mat.(col data k)) ~style:"p pt 7 lc 8" [ barebone ]) in
draw ~output:(png "tile") figure