Go to the first, previous, next, last section, table of contents.


The Plot module

type plotter
and plotter_format =
  | X | PNG | PNM | GIF | SVG | AI | PS | CGM
  | FIG | PCL | HPGL | REGIS | TEK | META (* | Xdrawable *)

Plotter parameters can be specified at creation time, either by passing them to the function makepl, or by reading the corresponding environment variable. The all have sensible default values. Not all parameters make sense, depending of the plotter format.

and plotter_parameter =

common parameters

 | DISPLAY of string			(* X *)
 | BITMAPSIZE of string			(* bitmap plotters *)
 | PAGESIZE of string			(* vector plotters *)
 | ROTATION of string			(* all plotters except meta *)
 | BG_COLOR of string			(* some plotters *)
     
 | EMULATE_COLOR of bool		(* all plotters *)
 | MAX_LINE_LENGTH of int		(* nearly all plotters *)
 | INTERLACE of bool			(* GIF PNG *)
 | TRANSPARENT_COLOR of string		(* GIF PNG *)

plotter-specific parameters

 | CGM_ENCODING of string 
 | CGM_MAX_VERSION of string 
 | GIF_ANIMATION of bool 
 | GIF_DELAY of int
 | GIF_ITERATIONS of int
 | HPGL_ASSIGN_COLORS of bool
 | HPGL_OPAQUE_MODE of bool
 | HPGL_PENS of string 
 | HPGL_ROTATE of string 
 | HPGL_VERSION of string
 | META_PORTABLE of bool
 | PCL_ASSIGN_COLORS of bool
 | PCL_BEZIERS of bool
 | PNM_PORTABLE of bool
 | TERM of string			(* TEK *)
 | USE_DOUBLE_BUFFERING of bool		(* X *)
 | VANISH_ON_DELETE of bool		(* X *)
 | X_AUTO_FLUSH of bool			(* X *)

The Xdrawable plotter is unsupported

| X_DRAWABLE_COLORMAP | X_DRAWABLE_DISPLAY | X_DRAWABLE_DRAWABLE1

| X_DRAWABLE_DRAWABLE2 | X_DRAWABLE_VISUAL

Exceptions

The libplot error handler raise the Error exception.

The Deleted_plotter exception is raised whenever a drawing operation is called upon an already deleted plotter. The Undeleted_plotter exception is raised when the Gc is about to reclaim a plotter value that has not been deleted yet (see deletepl).

The default warnings handler is to print messages on the error channel (if one was set when the plotter was created). This handler can be set by the function warnings : warnings f where f takes as argument the warning message as a string.

exception Error of string
exception Deleted_plotter
exception Undeleted_plotter

Creating \& deleting plotters

\indent The makepl function is used to create a plotter. It takes as argument a plotter_format, a list of plotter_parameter and one or two channels. The first one is the output channel. X plotters don't need any in fact so just put stdout. The second one is the error channel : warnings are printed on it. It is optionnal ; by default warnings are not printed.

The deletepl function destroys the plotter given as argument. For most of the plotter formats, it triggers the actual output of the data to the output channel. The libplot datatype is then freed. Any subsequent use of this plotter will raise a Deleted_plotter exception. On the contrary, if the plotter value becomes unreachable and is about to be reclaimed by the Gc and if it has not been deleted yet, Undeleted_plotter will be raised.

val version : string			(* Library version *)

val makepl : plotter_format -> out_channel -> 
  ?err_channel:out_channel -> plotter_parameter list -> plotter

val deletepl : plotter -> unit

Plotting functions

All these functions are described in section 9.4 of the plotutils manual. Most of them are external.

Colors

There are two ways to specify colors with libplot : either by giving the red, green and blue values or by giving a name (libplot has a pretty big table of known color names). This is done using the color variant type.

type color = int * int * int

Control functions

val openpl : plotter -> unit

val bgcolor : plotter -> color -> unit

val erase : plotter -> unit

val space : plotter -> x0:int -> y0:int -> x1:int -> y1:int -> unit

val fspace : plotter -> x0:float -> y0:float -> x1:float -> y1:float -> unit

val space2 : plotter -> x0:int -> y0:int -> x1:int -> y1:int -> 
     x2:int -> y2:int -> unit

val fspace2 : plotter -> x0:float -> y0:float -> x1:float -> y1:float -> 
     x2:float -> y2:float -> unit

val havecap : plotter -> s:string -> unit

val flushpl : plotter -> unit

val closepl : plotter -> unit

Object drawing functions

type h_justify = | Left | Center_h | Right
type v_justify = | Bottom | Baseline | Center_v | Cap_line | Top

val alabel : plotter -> h_justify -> v_justify -> string -> unit

val arc : plotter -> xc:int -> yc:int -> x0:int -> y0:int -> 
     x1:int -> y1:int -> unit

val farc : plotter -> xc:float -> yc:float -> x0:float -> y0:float ->
     x1:float -> y1:float -> unit

val arcrel : plotter -> dxc:int -> dyc:int -> dx0:int -> dy0:int -> 
     dx1:int -> dy1:int -> unit

val farcrel : plotter -> dxc:float -> dyc:float -> dx0:float -> 
     dy0:float -> dx1:float -> dy1:float -> unit

val bezier2 : plotter -> x0:int -> y0:int -> x1:int -> y1:int -> 
     x2:int -> y2:int -> unit

val fbezier2 : plotter -> x0:float -> y0:float -> x1:float -> y1:float -> 
     x2:float -> y2:float -> unit

val bezier2rel : plotter -> dx0:int -> dy0:int -> dx1:int -> dy1:int -> 
     dx2:int -> dy2:int -> unit

val fbezier2rel : plotter -> dx0:float -> dy0:float -> dx1:float -> dy1:float -> 
     dx2:float -> dy2:float -> unit

val bezier3 : plotter -> x0:int -> y0:int -> x1:int -> y1:int -> 
     x2:int -> y2:int -> x3:int -> y3:int -> unit

val fbezier3 : plotter -> x0:float -> y0:float -> x1:float -> y1:float -> 
     x2:float -> y2:float -> x3:float -> y3:float -> unit

val bezier3rel : plotter -> dx0:int -> dy0:int -> dx1:int -> dy1:int -> 
     dx2:int -> dy2:int -> dx3:int -> dy3:int -> unit

val fbezier3rel : plotter -> dx0:float -> dy0:float -> dx1:float -> dy1:float -> 
     dx2:float -> dy2:float -> dx3:float -> dy3:float -> unit

val box : plotter -> x0:int -> y0:int -> x1:int -> y1:int -> unit

val fbox : plotter -> x0:float -> y0:float -> x1:float -> y1:float -> unit

val boxrel : plotter -> dx0:int -> dy0:int -> dx1:int -> dy1:int -> unit

val fboxrel : plotter -> dx0:float -> dy0:float -> dx1:float -> 
     dy1:float -> unit

val circle : plotter -> x:int -> y:int -> r:int -> unit

val fcircle : plotter -> x:float -> y:float -> r:float -> unit

val circlerel : plotter -> dx:int -> dy:int -> r:int -> unit

val fcirclerel : plotter -> dx:float -> dy:float -> r:float -> unit

val cont : plotter -> x:int -> y:int -> unit

val fcont : plotter -> x:float -> y:float -> unit

val contrel : plotter -> x:int -> y:int -> unit

val fcontrel : plotter -> dx:float -> dy:float -> unit

val ellarc : plotter -> xc:int -> yc:int -> x0:int -> y0:int -> 
     x1:int -> y1:int -> unit

val fellarc : plotter -> xc:float -> yc:float -> x0:float -> y0:float -> 
     x1:float -> y1:float -> unit

val ellarcrel : plotter -> dxc:int -> dyc:int -> dx0:int -> dy0:int -> 
     dx1:int -> dy1:int -> unit

val fellarcrel : plotter -> dxc:float -> dyc:float -> dx0:float -> dy0:float -> 
     dx1:float -> dy1:float -> unit

val ellipse : plotter -> x:int -> y:int -> rx:int -> ry:int -> 
     angle:int -> unit

val fellipse : plotter -> x:float -> y:float -> rx:float -> ry:float -> 
     angle:float -> unit

val ellipserel : plotter -> dx:int -> dy:int -> rx:int -> ry:int -> 
     angle:int -> unit

val fellipserel : plotter -> dx:float -> dy:float -> rx:float -> ry:float -> 
     angle:float -> unit

val endpath : plotter -> unit

val endsubpath : plotter -> unit

val closepath : plotter -> unit

val label : plotter -> s:string -> unit

val labelwidth : plotter -> string -> int

val flabelwidth : plotter -> string -> float

val line : plotter -> x0:int -> y0:int -> x1:int -> y1:int -> unit

val fline : plotter -> x0:float -> y0:float -> x1:float -> y1:float -> unit

val linerel : plotter -> dx0:int -> dy0:int -> dx1:int -> dy1:int -> unit

val flinerel : plotter -> dx0:float -> dy0:float -> 
     dx1:float -> dy1:float -> unit
type marker = | No_marker | Dot | Plus | Asterisk | Circle | Cross | Square 
	      | Triangle | Diamont | Star | Inv_triangle | Starburst 
	      | Marker of int

val marker : plotter -> x:int -> y:int -> marker -> size:int -> unit

val fmarker : plotter -> x:float -> y:float -> marker -> size:float -> unit

val markerrel : plotter -> x:int -> y:int -> marker -> size:int -> unit

val fmarkerrel : plotter -> x:float -> y:float -> marker -> size:float -> unit

val point : plotter -> x:int -> y:int -> unit

val fpoint : plotter -> x:float -> y:float -> unit

val pointrel : plotter -> dx:int -> dy:int -> unit

val fpointrel : plotter -> dx:float -> dy:float -> unit

Attribute setting functions

type capmod = | Butt | Round_c | Projecting | Triangular

val capmod : plotter -> capmod -> unit

val color : plotter -> color -> unit

val fillcolor : plotter -> color -> unit
type fillmod = | Alternate | Winding

val fillmod : plotter -> fillmod -> unit

val filltype : plotter -> level:int -> unit

val fmiterlimit : plotter -> limit:float -> unit

val fontname : plotter -> string -> int

val ffontname : plotter -> string -> float

val fontsize : plotter -> int -> int

val ffontsize : plotter -> float -> float
type joinmod = | Miter | Round_j | Bevel

val joinmod : plotter -> joinmod -> unit

val linedash : plotter -> dashes:int array -> offset:int -> unit

val flinedash : plotter -> dashes:float array -> offset:float -> unit
type linemod = | Solid | Dotted | Dotdashed | Shortdashed | Longdashed 
	       | Dotdotdashed | Dotdotdotdashed | Disconnected

val linemod : plotter -> linemod -> unit

val linewidth : plotter -> size:int -> unit

val flinewidth : plotter -> size:float -> unit

val move : plotter -> x:int -> y:int -> unit

val moverel : plotter -> x:int -> y:int -> unit

val fmove : plotter -> x:float -> y:float -> unit

val fmoverel : plotter -> dx:float -> dy:float -> unit
type direction = | Clockwise | Counterclockwise

val orientation : plotter -> direction -> unit

val pencolor : plotter -> color -> unit

val pentype : plotter -> level:int -> unit

val restorestate : plotter -> unit

val savestate : plotter -> unit

val textangle : plotter -> int -> int

val ftextangle : plotter -> float -> float

Mapping functions

val fsetmatrix : plotter -> m0:float -> m1:float -> m2:float -> m3:float -> 
     m4:float -> m5:float -> unit

val fconcat : plotter -> m0:float -> m1:float -> m2:float -> m3:float -> 
     m4:float -> m5:float -> unit

val frotate : plotter -> theta:float -> unit

val fscale : plotter -> x:float -> y:float -> unit

val ftranslate : plotter -> x:float -> y:float -> unit
val pencolorname : plotter -> name:string -> unit


Go to the first, previous, next, last section, table of contents.