Module Gnuplot

Simple interface to Gnuplot

Auxiliary types

module Color : sig ... end
type date = float
type time = float
type timezone = float
module Range : sig ... end
type range = Range.t =
  1. | X of float * float
  2. | Y of float * float
  3. | XY of float * float * float * float
    (*

    arguments are x1, x2, y1, y2

    *)
  4. | XYZ of float * float * float * float * float * float
    (*

    arguments are x1, x2, y1, y2, z1, z2

    *)
  5. | Date of date * date
  6. | Time of time * time * timezone
  7. | Local_time of time * time
    (*

    Time range in local time zone.

    *)
module Filling : sig ... end
module Output : sig ... end
module Labels : sig ... end
type dim2 =
  1. | Dim2

The representation of data-arrays (cf. the Series module).

type dim3 =
  1. | Dim3
type 'dim data =
  1. | Data_Y : float list -> dim2 data
  2. | Data_XY : (float * float) list -> dim2 data
  3. | Data_XYZ : (float * float * float) list -> dim3 data
  4. | Data_TimeY : (time * float) list * timezone -> dim2 data
  5. | Data_DateY : (date * float) list -> dim2 data
  6. | Data_TimeOHLC : (time * (float * float * float * float)) list * timezone -> dim2 data
  7. | Data_DateOHLC : (date * (float * float * float * float)) list -> dim2 data
  8. | Func : string -> dim2 data
module Series : sig ... end
module Splots : sig ... end

Main interface

type t

A wrapper for calling Gnuplot from OCaml.

val create : ?verbose:bool -> ?path:string -> unit -> t

create ?verbose ?path () creates a channel to a Gnuplot process with the executable given by path. If verbose is true then plotting commands print debug information on standard output.

val close : t -> unit

close t closes the channel to the Gnuplot process.

val with_ : ?verbose:bool -> ?path:string -> (t -> 'a) -> 'a

with_ ?verbose ?path f creates a channel to a Gnuplot process, using create. Then it calls f with this channel, and makes sure to close the channel once f is done.

val set : ?output:Output.t -> ?title:string -> ?use_grid:bool -> ?fill:Filling.t -> ?labels:Labels.t -> ?custom:(string * string) list -> t -> unit

set ?output ?title ?fill ?labels ?custom t sets parameters of the Gnuplot session.

  • parameter custom

    since 0.7 to specify other settings (set/unset pairs)

val unset : ?fill:Filling.t -> ?labels:Labels.t -> ?custom:(string * string) list -> t -> unit

unset ?fill ?labels t resets parameters of the Gnuplot session.

val plot : ?output:Output.t -> ?title:string -> ?use_grid:bool -> ?fill:Filling.t -> ?range:Range.t -> ?labels:Labels.t -> ?format:string -> ?logscale:(string * int option) -> ?custom:(string * string) list -> t -> Series.t -> unit

plot t series plots a single data series. The parameters for filling, range, etc are optional.

val plot_many : ?output:Output.t -> ?title:string -> ?use_grid:bool -> ?fill:Filling.t -> ?range:Range.t -> ?labels:Labels.t -> ?format:string -> ?logscale:(string * int option) -> ?custom:(string * string) list -> t -> Series.t list -> unit

plot_many t series creates a plot of multiple data series. The parameters for filling, range, etc are optional.

val plot_func : ?output:Output.t -> ?title:string -> ?use_grid:bool -> ?fill:Filling.t -> ?range:Range.t -> ?labels:Labels.t -> ?logscale:(string * int option) -> ?custom:(string * string) list -> t -> string -> unit

plot_func t f draws a graph of the function f given as a string. The function f has to be specified in the Gnuplot format, eg `sin(x)`. The parameters for the filling, range, etc are optional.

val splot : ?output:Output.t -> ?title:string -> ?use_grid:bool -> ?fill:Filling.t -> ?range:Range.t -> ?labels:Labels.t -> ?logscale:(string * int option) -> ?custom:(string * string) list -> t -> Splots.t -> unit

splot t s creates a 3d plot for s. The parameters for filling, range, etc are optional.

val splot_many : ?output:Output.t -> ?title:string -> ?use_grid:bool -> ?fill:Filling.t -> ?range:Range.t -> ?labels:Labels.t -> ?logscale:(string * int option) -> ?custom:(string * string) list -> t -> Splots.t list -> unit

splot_many t ls creates a 3d plot for the list of data ls. The parameters for filling, range, etc are optional.