graphinglib.Text.__init__#

Text.__init__(x: float, y: float, text: str, color: str | Inherit = Inherit, font_size: float | Literal['same as figure'] = 'same as figure', alpha: float | Inherit = Inherit, h_align: str | Inherit = Inherit, v_align: str | Inherit = Inherit, rotation: float = 0.0, highlight_color: str | None = None, highlight_alpha: float = 1.0, highlight_padding: float = 0.1) None[source]#

This class allows text to be plotted.

It is also possible to attach an arrow to the Text with the method attach_arrow() to point at something of interest in the plot.

Parameters:
x, yfloat

The x and y coordinates at which to plot the Text.

textstr

The text to be plotted.

colorstr

Color of the text. Default depends on the figure_style configuration.

font_sizefloat

Font size of the text. Typical range is 8 to 20. Default depends on the figure_style configuration.

alphafloat

Opacity of the text. Range is 0 (transparent) to 1 (opaque). Default depends on the figure_style configuration.

h_align, v_alignstr

Horizontal and vertical alignment of the text. Horizontal alignment values include "left", "center", and "right". Vertical alignment values include "bottom", "baseline", "center", "center_baseline", and "top". Default depends on the figure_style configuration.

rotationfloat

Rotation angle of the text in degrees. Defaults to 0.

highlight_colorstr, optional

Color of the background highlight box behind the text. If specified, a box will be drawn behind the text. Default is None (no highlight).

highlight_alphafloat, optional

Opacity of the highlight box. Range is 0 (transparent) to 1 (opaque). Defaults to 1.0.

highlight_paddingfloat, optional

Padding around the text for the highlight box. A value of 0 means no padding. Defaults to 0.1.

Notes

Color parameters accept Matplotlib color formats: named colors ("blue"), short color strings ("b"), hex strings ("#0000ff"), grayscale strings ("0.5"), and RGB/RGBA tuples with values between 0 and 1 ((0, 0, 1) or (0, 0, 1, 0.5)).