package gnuplot

  1. Overview
  2. Docs

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. | Date of date * date
  5. | Time of time * time * timezone
  6. | Local_time of time * time
    (*

    Time range in local time zone.

    *)
module Filling : sig ... end
module Output : sig ... end
module Labels : sig ... end
module Series : 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 -> t -> unit

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

val unset : ?fill:Filling.t -> ?labels:Labels.t -> 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 -> 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 -> 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 -> 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.

OCaml

Innovation. Community. Security.