Module Archimedes

module Archimedes: sig .. end
A 2D plotting library with various backends.
Author(s): Christophe Troestler, Pierre Hauweele, Fabian Pijcke, Noémie Meunier, Bertrand Desmons
Version: 0.4.7


    module A = Archimedes
    let vp = A.init ["graphic"; "hold"] in vp;
    A.fx vp sin 0. 10.;
    A.close vp

Affine transformations

module Matrix: sig .. end
Module implementing affine transformations and various operations on them.

Base elements of a plot

module Color: sig .. end
Abstract representation of colors (suitable for RGBA).
module Path: sig .. end
Creating abstract paths.

Registering backends

module Backend: sig .. end
Module providing a uniform interface and managing the dynamic loading of the backends.

Managing viewports

module Coordinate: sig .. end
Systems of coordinates (inhomogeneous homotheties) relative to other coordinate systems with automatic updates.
module Viewport: sig .. end
Area on which graphs can be made.

Sampling functions

module Sampler: sig .. end
Adaptative sampling of functions.

High level functions

module Marker: sig .. end
Module handling point styles and marks.
module Arrows: sig .. end
Arrow styles
module Tics: sig .. end
Tics position and labels.
module Axes: sig .. end
Routines to draw basic axes systems in a 2-dimensional space.

Initializing Archimedes

val init : ?lines:float ->
?text:float ->
?marks:float ->
?bg:Color.t ->
?w:float ->
?h:float -> ?dirs:string list -> string list -> Viewport.t
init backend initializes Archimedes and returns the main viewport using the backend specified. The first element of backend is the name (case insensitive) of the underlying engine. It may be followed by one or several options. For example, "Graphics" for the graphics backend or "Cairo"; "PNG"; filename for the Cairo backend, using a PNG surface to be saved to filename. The empty list selects "Graphics"; "hold".
lines : the width of the lines. Default: 1. which corresponds to a line width on the backend of min w h /. 500..
text : the size of the text. Default: 12. which corresponds to puting about 42 lines of text in min w h height.
marks : the size of the marks. Default: 7. which corresponds packing about 100 marks in min w h.
bg : the color of the background. Default: Archimedes.Color.white.
w : the width of the main viewport (in backend's unit).
h : the height of the main viewport (in backend's unit).
dirs : a list of directories where Archimedes looks for libraries (cma or cmxs) for dynamically loaded backends. The default is the directory where the backends that come with Archimedes were installed.
val backend_of_filename : string -> string list
Selects a backend according to the filename suffix. If the suffix is not matched (this in particular for ""), the graphics backend is selected.
val show : Viewport.t -> unit
Alias for
val close : Viewport.t -> unit
val set_color : Viewport.t -> Color.t -> unit
Alias for Archimedes.Viewport.set_color.
val set_line_width : Viewport.t -> float -> unit
Alias for Archimedes.Viewport.set_line_width.
val xrange : Viewport.t -> float -> float -> unit
Alias for Archimedes.Viewport.xrange.
val yrange : Viewport.t -> float -> float -> unit
Alias for Archimedes.Viewport.yrange.

Plotting various datatypes

type style = [ `Bars of float
| `HBars of float
| `Impulses
| `Lines
| `Linesmarkers of string
| `Markers of string ]
Style of various plots. Plotting functions only support the subset of these style that make sense for them.

For the list of default marks for `Markers and `Linesmarkers have a look to Archimedes.Marker.names. You can also define your own with Archimedes.Marker.add.
val fx : Viewport.t ->
?tlog:bool ->
?n:int ->
?strategy:Sampler.strategy ->
?cost:Sampler.cost ->
?style:[ `Lines | `Linesmarkers of string | `Markers of string ] ->
?base:(float -> float) ->
?fill:bool ->
?fillcolor:Color.t -> (float -> float) -> float -> float -> unit
Plotting functions.

fx vp f a b draws the graph of the function f on the interval [a, b].

n : the maximum number of function evaluations. Default: 100.
strategy : see Archimedes.Sampler.strategy.
cost : see Archimedes.Sampler.cost.
style : the style of the plot. Default: `Lines.
base : the second function for delimiting the filling region. Default: the identically zero function.
fill : whether to fill the region between the graph of f and the base. Default: false.
fillcolor : the color for filling. Default: Archimedes.Color.white_smoke.
val xyf : Viewport.t ->
?tlog:bool ->
?n:int ->
?strategy:Sampler.strategy ->
?cost:Sampler.cost ->
?style:[ `Lines | `Linesmarkers of string | `Markers of string ] ->
?fill:bool ->
?fillcolor:Color.t ->
(float -> float * float) -> float -> float -> unit
xyf vp f a b draws the image of the function f on the interval [a, b], that is the set of points (x,y) = f(t) for t in [a,b].

The optional arguments are the same as for Archimedes.fx.

module Array: sig .. end
Plotting float Arrays.
module List: sig .. end
Plotting Lists of floats.
module Vec: sig .. end
Plotting Fortran bigarrays.
module CVec: sig .. end
Plotting C bigarrays.

Plotting generic data

val y : Viewport.t ->
?base:((float -> unit) -> unit) ->
?fill:bool ->
?fillcolor:Color.t ->
?style:style -> ((float -> unit) -> unit) -> unit
y vp iter draws on vp the values provided by the iterator iter. See Archimedes.Array.y for more information.
val xy : Viewport.t ->
?fill:bool ->
?fillcolor:Color.t ->
?style:[ `Lines | `Linesmarkers of string | `Markers of string ] ->
((float -> float -> unit) -> unit) -> unit
xy vp iter plots on vp the values provided by the iterator iter. See Archimedes.Array.xy for more information.


module Piechart: sig .. end