Gp.Plot
Contains all the commands you need to draw your figure
val plot : ?using:string -> ?axes:string -> ?legend:string -> ?style:string ->
data -> property list -> unit
Invoke gnuplot's plot
command on some data.
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 heatmap : ?style:string ->
[ `grid of Owl.Mat.mat * Owl.Mat.mat * Owl.Mat.mat | `mat of Owl.Mat.mat ] -> property list -> 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