github ↗
docs menu

Module Hugin.Role

Roles.

A role is a mark's slot for a channel (Roles). It is identified by its name, and a parameter (Role.param) by its name and the call that made it.

#type ('d, 'r) t

The type for roles taking channels of domain values 'd and range 'r.

Positions

#val x : ('d, float) t

x is the horizontal position.

#val x2 : ('d, float) t

x2 is the other end of a horizontal extent, on the scale of x.

#val y : ('d, float) t

y is the vertical position.

#val y2 : ('d, float) t

y2 is the other end of a vertical extent, on the scale of y.

Appearance

#val fill : ('d, Color.t) t

fill is the colour that fills shapes and glyphs.

#val stroke : ('d, Color.t) t

stroke is the colour that draws lines and outlines.

#val opacity : ('d, float) t

opacity is an opacity in [0;1].

#val size : (float, float) t

size is an area, in square points.

#val width : ('d, float) t

width is a line width, in points.

#val symbol : (string, Symbol.t) t

symbol is a marker shape.

#val dash : (string, Dash.t) t

dash is a dash pattern.

#val text : ('d, Text.t) t

text is a text. It reads no scale (Roles).

Facets

#val fx : (string, string) t

fx is the column of facet panels.

#val fy : (string, string) t

fy is the row of facet panels.

Values

#val value : name:string -> (float, float) t

value ~name is the role name whose values are the quantities of its channel as they are, nan where missing: it reads no scale, contributes to no domain and yields no guide, so a channel given to it has neither a scale nor a title (Mark.v). It gives a draw function values that are neither positions nor colours, such as a cart's angle.

Raises Invalid_argument if name is empty or is the name of a role above.

#val param : name:string -> equal:('r -> 'r -> bool) -> (unit, 'r) t

param ~name ~equal is a new role name for a parameter of a mark, a value of any type: its domain unit holds no data, so only const binds it, and Mark.get gives the constant once per row. It reads no scale, contributes to no domain and yields no guide. Figure equality (equal) compares its constants with equal, so a mark that keeps a curve or a tensor this way is equal to itself rebuilt.

Each call makes another role, which Mark.get does not confuse with one of the same name, and which makes a mark unequal to one made with another: a mark makes its parameters once, at the top level.

Raises Invalid_argument if name is empty or is the name of a role above.