Library
Module
Module type
Parameter
Class
Class type
THIS API IS NOT FIXED AND MAY CHANGE BEFORE THE 5.10.0 RELEASE
The different sides of a (2D) plot. These values are used to represent, e.g., offsets along axes and text placement.
type axis_options_t = [
| `axis
| `frame0
| `frame1
| `time
| `fixed_point
| `major_grid
| `minor_grid
| `invert_ticks
| `log
| `unconventional_label
| `label
| `custom_label
| `minor_ticks
| `minor_tick_count of int
| `major_ticks
| `major_tick_spacing of float
| `vertical_label
]
These are the available options for drawing plot axes. These values map to individual letters provided to Plplot.plbox
and similar functions.
type color_t = [
| `white
| `red
| `yellow
| `green
| `gray
| `blue
| `light_blue
| `purple
| `pink
| `black
| `brown
| `index of int
]
Colors from the indexed color map (color map 0), from the cmapo_alternate.pal
file! Note that these will NOT match up with colors from the default color palette!
Different map outlines available for map
A plottable element, usable by the function plot
.
The different available plot device families. This is not a complete representation of all of the available devices provided by PLplot.
type plot_device_t = [
| `pdf of plot_device_family_t
| `png of plot_device_family_t
| `ps of plot_device_family_t
| `svg of plot_device_family_t
| `window of plot_device_family_t
| `prompt
Ask for the correct device to use at run-time
*)| `stream of int
Pre-defined plot streams
*)| `other_device of string
]
Plot devices. The constructor argument allows one to define which device family is used.
PLplot plotting devices otherwise not available from this list
Type of scaling to use for plot axes, as in Plplot.plenv
.
type line_style_t = [
| `solid
| `line1
| `line2
| `line3
| `line4
| `line5
| `line6
| `line7
| `line8
| `custom of (int * int) list
]
Line plotting styles/patterns.
A custom line style, with each (mark, space) pair defining the length of one segment and gap in the line drawing pattern.
val default_axis_options : axis_options_t list
The default list of axis rendering options, used for all plots generated with init
if no custom options are provided.
val rgb_of_color : color_t -> int * int * int
Convert color_t
values to r, g, b
integer values, each ranging in value from 0 - 255
.
val recommended_extension : plot_device_t -> string
A recommended/standard file name extension, given a particular plot device.
val make_stream : ?stream:int -> unit -> stream_t
Make a new stream_t
, possibly using an existing plot stream index. If no stream
argument is provided then a new plot stream is created.
val start_page :
?stream:stream_t ->
(float * float) ->
(float * float) ->
plot_scaling_t ->
unit
start_page ?stream (x0, y0) (x1, y1) scaling
starts a new plot page with the given dimensions and scaling.
val next_page :
?stream:stream_t ->
(float * float) ->
(float * float) ->
plot_scaling_t ->
unit
An alias for start_page
.
val make :
?stream:stream_t ->
?filename:string ->
?size:(int * int) ->
?pre:(unit -> unit) ->
plot_device_t ->
stream_t
Create a new plot instance. See init
for a description of the parameters.
val init :
?filename:string ->
?size:(int * int) ->
?pages:(int * int) ->
?pre:(unit -> unit) ->
(float * float) ->
(float * float) ->
plot_scaling_t ->
plot_device_t ->
stream_t
init ?filename ?size ?pages (x0, y0) (x1, y1) scale device
- Start a new plot stream for a 2D plot with plot axis extents given by (x0, y0)
to (x1, y1)
. A call to init
is roughly equivalent to calling make
and then start_page
.
val with_stream : ?stream:stream_t -> (unit -> 'a) -> 'a
with_stream ?stream f
performs f
with stream
as the active plot stream. If stream
is not provided then the currently active plot stream is left active. Once f
is complete, the previously active plot stream is restored.
val make_stream_active : stream:stream_t -> unit
make_stream_active stream
makes stream
in to the currently active plot stream for The standard PLplot API calls or any function which is not provided with an explicit stream
argument.
set_color ?stream color
sets the current active plot color to color
.
val set_color_scale :
?stream:stream_t ->
?pos:float array ->
?alt_hue_path:bool array ->
color_t array ->
unit
set_color_scale ?stream ?pos ?alt_hue_path colors
sets the continuous color map (color map 1) to a scale determined by interpolating between colors
. pos
can be used to specify where in the color scale (0.0 - 1.0
) the a color interpolation point should fall. pos
defaults to even spacing. alt_hue_path
can be used to specify that a given segment should be interpolated using the alternative hue path which always includes the hue=0 point. Plplot.plscmap1l
is used internally to set the color scale.
val indexed_palette : string -> color_palette_t
PLplot has two color palettes - indexed (color map 0) and continuous (color map 1). These functions can be used with load_palette
to set custom indexed and continuous color palettes.
val continuous_palette : ?interpolate:bool -> string -> color_palette_t
continuous_palette ?interpolate filename
- If interpolate
is true (the default) then a smooth palette is generated using the color definitions in the palette file filename
. Otherwise, the colors are considered to be discrete, giving a segmented palette.
val load_palette : ?stream:stream_t -> color_palette_t -> unit
load_palette ?stream palette
loads either indexed or continuous color palette information from a file on disk.
val arc :
?fill:bool ->
color_t ->
float ->
float ->
float ->
float ->
float ->
float ->
float ->
plot_t
arc ?fill color x y a b angle0 angle1 rotate
val axes :
?color:color_t ->
?style:line_style_t ->
?width:float ->
?labelfunc:([ `x | `y | `z ] -> float -> string) ->
axis_options_t list ->
axis_options_t list ->
plot_t
axes ?color ?style ?width xopt yopt
val default_axes : plot_t
default_axes
is equivalent to axes default_axis_options default_axis_options
contours color tranform_func contours data
val image :
?range:(float * float) ->
(float * float) ->
(float * float) ->
float array array ->
plot_t
image ?range (x0, y0) (x1, y1) data
val imagefr :
?range:(float * float) ->
scale:(float * float) ->
(float * float) ->
(float * float) ->
float array array ->
plot_t
imagefr ?range ~scale (x0, y0) (x1, y1) data
val join :
?style:line_style_t ->
?width:float ->
color_t ->
(float * float) ->
(float * float) ->
plot_t
join ?style color (x0, y0) (x1, y1)
label ?color x_label y_label title
adds axis labels and a title.
val lines :
?label:string ->
?style:line_style_t ->
?width:float ->
color_t ->
float array ->
float array ->
plot_t
lines ?label ?style color xs ys
map ?sw ?ne color outline_type
val points :
?label:string ->
?symbol:string ->
?scale:float ->
color_t ->
float array ->
float array ->
plot_t
points ?label ?symbol ?scale color xs ys
polygon ?fill color xs ys
rectangle ?fill color (x0, y0) (x1, y1)
val shades :
?fill_width:float ->
?contour:(color_t * float) ->
?rect:bool ->
(float * float) ->
(float * float) ->
float array ->
float array array ->
plot_t
shades ?fill_width ?contour ?rect (x0, y0) (x1, y1) contours data
text ?dx ?dy ?just color x y string
writes the text string
inside the plot window, at an optional angle defined by the offsets dx
and dy
.
val text_outside :
?just:float ->
?perp:bool ->
color_t ->
float tagged_side_t ->
float ->
string ->
plot_t
text_outside ?just ?perp color side offset string
writes text outside of the plot window, along side
, displaced from the axis by offset
* character height.
val func :
?symbol:string ->
?step:float ->
color_t ->
(float -> float) ->
(float * float) ->
plot_t
func ?symbol ?step color f (min, max)
plots the function f
from x = min
to x = max
. step
can be used to tighten or coarsen the sampling of plot points.
val clear_transform : plot_t
clear_transform
clears any currently defined universal coordinate transform function.
pltr f
sets the coordinate transformation function used by imagefr
and other functions affected by Plplot.plset_pltr
.
val clear_pltr : plot_t
clear_pltr
clears any currently defined function-specific pltr transform function.
val custom : (unit -> unit) -> plot_t
custom f
will call f ()
when the plot element is used. This function can be used to create customized plot elements for use with plot
.
list l
makes a plot element from a list of plot elements, allowing, for example, a plot to be created piece-by-piece before being rendered.
maybe m_p
will plot the contents of m_p
. If m_p
is None
then this is effectively a no-op.
val character_height : ?stream:stream_t -> unit -> float
Character height in world coordinate units
val viewport_pos :
?side1:side_t ->
?side2:side_t ->
?inside:bool ->
float ->
float ->
position_t
Position relative to the plot viewport
val subpage_pos :
?side1:side_t ->
?side2:side_t ->
?inside:bool ->
float ->
float ->
position_t
Position relative to the plot subpage
val no_legend : legend_entry_t
Empty legend entry
val box_legend :
?pattern:int ->
?scale:float ->
?line_width:float ->
?label_color:color_t ->
label:string ->
color_t ->
legend_entry_t
Color-filled box legend entry
val line_legend :
?style:int ->
?width:float ->
?label_color:color_t ->
label:string ->
color_t ->
legend_entry_t
Line legend entry
val symbol_legend :
?scale:float ->
?number:int ->
?label_color:color_t ->
label:string ->
color_t ->
string ->
legend_entry_t
Symbol/point legend entry
val row_major : 'a -> 'b -> ('a * 'b) layout_t
Row-major layout
val column_major : 'a -> 'b -> ('a * 'b) layout_t
Column-major layout
val legend :
?pos:position_t ->
?plot_width:float ->
?bg:color_t ->
?bb:(color_t * line_style_t) ->
?layout:(int * int) layout_t ->
?color:color_t ->
?text_offset:float ->
?text_scale:float ->
?text_spacing:float ->
?text_justification:float ->
?text_left:bool ->
legend_entry_t list list ->
plot_t
legend entries
val colorbar_axis : ?axis:axis_options_t list -> float array -> colorbar_axis_t
colorbar_axis ?axis values
creates a colorbar_axis_t
with the given axis options and range values.
val gradient_colorbar :
?axis:axis_options_t list ->
float array ->
colorbar_kind_t
gradient_colorbar ?axis [|min; max|]
from min
to max
val image_colorbar :
?axis:axis_options_t list ->
float array ->
colorbar_kind_t
image_colorbar ?axis [|min; max|]
from min
to max
val shade_colorbar :
?custom:bool ->
?axis:axis_options_t list ->
float array ->
colorbar_kind_t
shade_colorbar ?custom ?axis contours
defines a shaded contour colorbar with axis labels at even spacings (custom = false
) or at the locations of the values in contours
(custom = true
- the default).
val default_colorbar_axis : axis_options_t list
Default options used for a colorbar axis
val colorbar :
?pos:position_t ->
?bg:color_t ->
?bb:(color_t * line_style_t) ->
?cap:(float option * float option) ->
?contour:(color_t * float) ->
?orient:(float * float) tagged_side_t ->
?axis:colorbar_axis_t list ->
?label:string tagged_side_t list ->
?color:color_t ->
?scale:float ->
colorbar_kind_t ->
plot_t
colorbar colorbar_kind
val plot_axes :
?stream:stream_t ->
axis_options_t list ->
axis_options_t list ->
unit
Draw the plot axes on the current plot page
val end_stream : ?stream:stream_t -> unit -> unit
end_stream ?stream ()
ends stream
. This or finish
should be called once all plotting is complete.
val finish : ?stream:stream_t -> unit -> unit
finish ?stream ()
draws default x and y axes, then closes stream
.