Library
Module
Module type
Parameter
Class
Class type
Area on which graphs can be made.
val get_coord_from_name : t -> coord_name -> Coordinate.t
get_coord_from_name viewport coord_name
returns one of the coordinate systems of the viewport
val make :
t ->
?lines:float ->
?text:float ->
?marks:float ->
?redim:(t -> float -> float -> unit) ->
?coord:[ `Device | `Graph | `Orthonormal ] ->
float ->
float ->
float ->
float ->
t
make parent xmin xmax ymin ymax
creates and returns a viewport on top of parent
with top left corner (xmin
, ymin
) and bottom right corner (xmax
, ymax
).
val show : t -> unit
show vp
forces the viewport vp
and all its children to immediately display not yet processed instructions.
val redraw : t -> unit
show vp
forces the viewport vp
and all its children to immediately redraw all their current content.
get_backend vp
returns the backend associated to vp
, if vp is built over another viewport, the same backend is used.
val desync_ratio : t -> unit
desync_ratio vp
make vp
single. The ratio used will be the one used before desync.
sync_ratio vp vp_base
synchronizes vp
's ratio with the vp_base
's one.
val desync_range : ?x:bool -> ?y:bool -> t -> unit
desync_range vp
make vp
single. The range used will be the one used before desync.
sync_range vp vp_base
synchronizes vp
's ranges (according to ?x and ?y params) with the ranges of vp_base
. The range consists of a xmin and a xmax values, which defines the bounds of the viewport in Coordinate data.
val desync_unit_size : ?x:bool -> ?y:bool -> t -> unit
desync_unit_size vp
make vp
single. The unit size used will be the one used before desync.
sync_unit_size vp vp_base
synchronizes vp
's unit sizes (according to ?x and ?y params) with the sizes of vp_base
.
grid parent nx ny
returns vp
an array of nx
* ny
sub-viewports of parent
arranged in a grid of nx
columns and ny
rows. The bottom left viewport is vp.(0).(0)
, the one to its right (resp. above) is vp.(1).(0)
(resp. vp.(0).(1)
).
rows parent ny
returns vp
an array of ny
viewports arranged in a column, the bottom one being vp.(0)
.
columns parent nx
creates n_cols
viewports layouted in a row and returns them in an array of viewports
val layout_borders :
?north:float ->
?south:float ->
?west:float ->
?east:float ->
t ->
t * t * t * t * t
layout_borders parent
returns a 5-uple of viewports. The viewports are north, south, west, east, center and are placed conformally to their names.
val data_from : t -> coord_name -> (float * float) -> float * float
val ortho_from : t -> coord_name -> (float * float) -> float * float
val ortho_to : t -> coord_name -> (float * float) -> float * float
val set_line_width : t -> float -> unit
set_line_width vp w
set the absolute width of the lines on the viewport vp
to w
. Default is 1.
val set_font_size : t -> float -> unit
set_font_size vp s
set the absolute font size of the viewport vp
to s
. Default is 12.
val set_mark_size : t -> float -> unit
set_mark_size vp s
set the absolute mark size of the viewport vp
to s
. Default is 7
val set_rel_line_width : t -> float -> unit
set_rel_line_width vp w
. Same as set_line_width but relative to the viewport.
val set_rel_font_size : t -> float -> unit
set_rel_font_size vp s
. Same as set_font_size but relative to the viewport
val set_rel_mark_size : t -> float -> unit
set_rel_mark_size vp s
Same as set_mark_size but relative to the viewport
get_background_color vp
return the current background color of the viewport vp
val get_line_width : t -> float
get_line_width vp
return the current width of the lines on the viewport vp
val get_font_size : t -> float
get_font_size vp
return the current size of the font on the viewport vp
val get_mark_size : ?coord:coord_name_rstrct -> t -> float * float
get_mark_size vp
return (sx, sy)
the current size in x and y of the marks on the viewport vp
.
val lower_left_corner : t -> float * float
The device's coordinates of the viewport's lower left corner
val upper_right_corner : t -> float * float
The device's coordinates of the viewport's upper right corner
val dimensions : t -> float * float
The device's width and height of the viewport
set_color vp c
change the color of the elements in the viewport vp
to the color c
val set_global_line_cap : t -> Backend.line_cap -> unit
val set_global_dash : t -> float -> float array -> unit
val set_global_line_join : t -> Backend.line_join -> unit
val get_line_cap : t -> Backend.line_cap
val get_dash : t -> float array * float
val get_line_join : t -> Backend.line_join
val stroke : ?fit:bool -> t -> coord_name -> Path.t -> unit
stroke vp coord p
draw the path p
on the the viewport vp
in the coordinate system coord
. p
is unchanged.
val fill : ?fit:bool -> t -> coord_name -> Path.t -> unit
fill vp coord p
fill the region delimited by the path p
on the the viewport vp
in the coordinate system coord
. p
is unchanged.
val set_clip : t -> bool -> unit
set_clip vp c
whether to enable or disable clipping for every following instructions on vp
.
val clip_rectangle : t -> x:float -> y:float -> w:float -> h:float -> unit
set_clip vp c
whether to enable or disable clipping for every following instructions on vp
.
val select_font_face : t -> Backend.slant -> Backend.weight -> string -> unit
val text_extents :
t ->
?coord:coord_name_rstrct ->
?rotate:float ->
?pos:Backend.text_position ->
string ->
Matrix.rectangle
text_extents vp text
returns the extents of text
as displayed by Archimedes.Viewport.text
.
val text :
t ->
?coord:coord_name ->
?rotate:float ->
?pos:Backend.text_position ->
float ->
float ->
string ->
unit
text vp x y s
display the string s
at position (x, y)
. The text displayed in an orthonormal space, that means that it won't be stretched by the coordinate system coord
.
val mark : ?coord:coord_name -> t -> x:float -> y:float -> string -> unit
mark vp x y m
draw the mark given by m
on the viewport vp
at position (x,y)
if both x
and y
are finite. Otherwise, does nothing.
val axes_ratio : t -> float -> unit
axes_ratio vp ratio
forces axes to keep ratio
(w / h
).
val xrange : t -> float -> float -> unit
axes_ratio vp ratio
forces axes to keep ratio
(w / h
).
xrange vp xmin xmax
set the OX interval of the viewport vp
from xmin
to xmax
val yrange : t -> float -> float -> unit
xrange vp xmin xmax
set the OX interval of the viewport vp
from xmin
to xmax
yrange vp ymin ymax
set the OY interval of the viewport vp
from xmin
to xmax
val xlabel : t -> string -> unit
yrange vp ymin ymax
set the OY interval of the viewport vp
from xmin
to xmax
xlabel vp label
set the OX representation to label
for the viewport vp
val ylabel : t -> string -> unit
xlabel vp label
set the OX representation to label
for the viewport vp
ylabel vp label
set the OY representation to label
for the viewport vp
val title : t -> string -> unit
ylabel vp label
set the OY representation to label
for the viewport vp
title vp t
set the title t
above the viewport vp
val xmin : t -> float
xmin vp
return the xmin
of the range on the viewport vp
val xmax : t -> float
xmin vp
return the xmin
of the range on the viewport vp
xmax vp
return the xmax
of the range on the viewport vp
val ymin : t -> float
xmax vp
return the xmax
of the range on the viewport vp
ymin vp
return the ymin
of the range on the viewport vp
val ymax : t -> float
ymin vp
return the ymin
of the range on the viewport vp
ymax vp
return the ymax
of the range on the viewport vp
val xlog : t -> bool
xlog vp
return true if OX is in log scale on the viewport vp
val ylog : t -> bool
xlog vp
return true if OX is in log scale on the viewport vp
ylog vp
return true if OY is in log scale on the viewport vp
val set_xlog : t -> bool -> unit
ylog vp
return true if OY is in log scale on the viewport vp
set_xlog vp true
set a log scale on OX on the viewport vp
val set_ylog : t -> bool -> unit
set_xlog vp true
set a log scale on OX on the viewport vp
set_ylog vp true
set a log scale on OY on the viewport vp
val auto_fit : t -> float -> float -> float -> float -> unit
auto_fit vp x0 y0 x1 y1
ensures that the rectangle delimited by (x0, y0) and (x1, y1) is included into the axes' ranges
val fit : t -> Matrix.rectangle -> unit
fit vp r
ensures that the rectangle r
is included into the axes ranges.
val save : t -> unit
val restore : t -> unit
val set_line_width_direct : t -> float -> unit -> unit
val set_font_size_direct : t -> float -> unit -> unit
val set_mark_size_direct : t -> float -> unit -> unit
val set_rel_line_width_direct : t -> float -> unit -> unit
val set_rel_font_size_direct : t -> float -> unit -> unit
val set_rel_mark_size_direct : t -> float -> unit -> unit
val set_line_cap_direct : t -> Backend.line_cap -> unit -> unit
val set_dash_direct : t -> float -> float array -> unit -> unit
val set_line_join_direct : t -> Backend.line_join -> unit -> unit
val stroke_direct : t -> coord_name -> Path.t -> unit -> unit
val fill_direct : t -> coord_name -> Path.t -> unit -> unit
val clip_rectangle_direct :
t ->
x:float ->
y:float ->
w:float ->
h:float ->
unit ->
unit
val select_font_face_direct :
t ->
Backend.slant ->
Backend.weight ->
string ->
unit ->
unit
val show_text_direct :
t ->
coord_name ->
?rotate:float ->
x:float ->
y:float ->
Backend.text_position ->
string ->
unit ->
unit
val mark_direct :
?coord:coord_name ->
t ->
x:float ->
y:float ->
string ->
unit ->
unit
val save_direct : t -> unit -> unit
val restore_direct : t -> unit -> unit
val add_instruction : t -> (unit -> unit) -> unit
val do_instructions : t -> unit
val remove_last_instruction : t -> unit
val clear_instructions : t -> unit