gp / src / gp.mli

(** Plotting module -- interface to Gnuplot.
   @see <http://www.gnuplot.info> the Gnuplot manual
   @author Guillaume Hennequin (gje.hennequin\@gmail.com) *)

(*
   
   Copyright (C) 2010 - 2011 Guillaume Hennequin
   
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see http://www.gnu.org/licenses
   
   *)

type t

(** creates a gnuplot instance, to which you can subsequently send commands.
   [~device:(terminal, file)] specifies where the plot should be performed
   (e.g. [("pdf enhanced size 10cm,8cm font 'Luxi Sans, 6'", "my_plot.pdf")]) *)
val figure : ?device:string * string -> unit -> t
   
(** send a command (string) to Gnuplot for direct execution *)
val send : string list -> t -> unit
   
(** flush the command queue *)
val flush : t -> unit
   
(** close the gnuplot instance *)
val close : t -> unit
   
(** send a vector of columns to gnuplot ;
   the columns are actually the lines of your vectors, i.e.
   [sendColumns [| col1; col2; ... |]] ;
   useful with [plot '-'] *)
val send_columns : float array array -> t -> unit
   
(** send matrix data to gnuplot -- for use with [splot()] *)
val send_matrix : float array array -> t -> unit
   
(** plot data ; this is rather flexible, you can do stuff like
   {[ plot [[x1;y1], "t 'foo' w l ls 7";
   [y2], "w p pt 7 lc 7, sin(x) w l lc 3"] f ]} *)
val plot : (float array list * string) list -> t -> unit
   
(** [splot mat f] plots matrix [mat] in heat map form *)
val splot : (float array array * string) -> t -> unit
   
   
   (** some useful shortcuts *)
   
(** very useful to align stuff in multiplot.
   Margins should be given as percentage of total screen area *)
val margins : ?t:float -> ?b:float -> ?l:float -> ?r:float -> t -> unit
   
val xrange : float -> float -> t -> unit
   
val yrange : float -> float -> t -> unit
   
val title : string -> t -> unit
   
(** organize a set of plots in a multiplot layout form,
   with given spaces between rows and columns;
   [multiplot 2 1 0.05 0.05 [[x1;y1],"w l lc 1";[x2;y2],"w l lc 3"]] *)
val multiplot : int -> int -> float -> float -> (t -> 'a) list -> t -> unit
   
(** quick plotting -- does the figure creation for you, but you don't have access
   to it since it's closed right after your plot;
   e.g. [quick (plot [[a;b],"w l lc 7"])] *)
val quick : (t -> unit) -> unit
   
   
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.