plotnine.themes.element_text

class plotnine.themes.element_text(family: str | list[str] | None = None, style: str | None = None, weight: int | str | None = None, color: str | TupleFloat3 | TupleFloat4 | None = None, size: float | None = None, ha: Literal['center', 'left', 'right'] | None = None, va: Literal['center', 'top', 'bottom', 'baseline'] | None = None, rotation: float | None = None, linespacing: float | None = None, backgroundcolor: str | TupleFloat3 | TupleFloat4 | None = None, margin: dict[str, Any] | None = None, **kwargs: Any)[source]

Theme element: Text

Parameters:
familystr

Font family. See matplotlib.text.Text.set_family() for supported values.

stylestr in ['normal', 'italic', 'oblique']

Font style

colorstr | tuple

Text color

weightstr

Should be one of normal, bold, heavy, light, ultrabold or ultralight.

sizefloat

text size

hastr in ['center', 'left', 'right']

Horizontal Alignment.

vastr in ['center' , 'top', 'bottom', 'baseline']

Vertical alignment.

rotationfloat

Rotation angle in the range [0, 360]

linespacingfloat

Line spacing

backgroundcolorstr | tuple

Background color

margindict

Margin around the text. The keys are one of ['t', 'b', 'l', 'r'] and units. The units are one of ['pt', 'lines', 'in']. The units default to pt and the other keys to 0. Not all text themeables support margin parameters and other than the units, only some of the other keys may apply.

kwargsdict

Parameters recognised by matplotlib.text.Text

Notes

element_text will accept parameters that conform to the ggplot2 element_text API, but it is preferable the Matplotlib based API described above.