This chapter documents the two classes Rayon uses to put text labels on visualizations. Labelers apply text labels to the drawing surface. Labeled markers marry labelers to markers, which can be used as labeled points, tickmarks, and other visual elements.
The following parameters may be used by the rendering backend to choose an appropriate font when drawing a label. The rendering backend may not honor these requests. At the time of this writing, only font size is honored in both backends. The wxPython backend honors font family, style and weight, while the Cairo backend does not.
Font size may be specified as a number (which is taken to be a point size), or one of the following strings specifying a relative size:
These are identical to the absolute size specifications described in <http://www.w3.org/TR/CSS2/fonts.html#font-size-props>; however, they specify relative, not absolute, sizes.
Font family is the string default (leaving font choice exclusively to the backend) or one of the strings specified in http://www.w3.org/TR/CSS2/fonts.html#generic-font-families , specifically:
Font style is one of the strings specified in http://www.w3.org/TR/CSS2/fonts.html#font-styling, specifically:
Font weight is one of the strings or integer weights specified in http://www.w3.org/TR/CSS2/fonts.html#font-boldness, specifically:
Integer weights may be specified as integers or strings. The bolder and lighter keywords are not implemented in Rayon.
halignThe horizontal alignment of the label may be one of the words left, center, or right.
valignThe vertical alignment of the label may be one of the words top, center, or bottom.
colorThe color of the label text is specified as described in Specifying Colors.
bgcolorThe color of the label background is specified as described in Specifying Colors.
angleThe angle of the text is measured counterclockwise in degrees from horizontal, left to right. Both horizontal and vertical alignment are computed relative to a bounding box rotated by the amount specified in angle.
border (border_left, border_right, border_top, border_bottom)The border of the text label is a text line specification (see Specifying Line Styles) describing the line to use to draw border lines around the label text’s bounding box. border_left, border_right, border_top and border_bottom specify lines that will only be drawn on the left, right, top and bottom edges of the box, respectively. If border is specified, the other border_ arguments will be ignored.
A labeler is a Rayon object that draws text; that text is a label. Labelers are created using the new_labeler method.