plotnine.element_text

element_text(
    family=None,
    style=None,
    weight=None,
    color=None,
    size=None,
    ha=None,
    va=None,
    ma=None,
    rotation=None,
    linespacing=None,
    backgroundcolor=None,
    margin=None,
    rotation_mode=None,
    kwargs={}
)

Theme element: Text

Parameters

family : Optional[str | list[str]] = None

Font family. See set_family for supported values.

style : Optional[str | Sequence[str]] = None

Font style

color : Optional[str | tuple[float, float, float] | tuple[float, float, float, float] | Sequence[str | tuple[float, float, float] | tuple[float, float, float, float]]] = None

Text color

weight : Optional[int | str | Sequence[int | str]] = None

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

size : Optional[float | Sequence[float]] = None

text size

ha : Optional[Literal["center", "left", "right"] | float] = None

Horizontal Alignment.

va : Optional[Literal["center", "top", "bottom", "baseline", "center_baseline"] | float] = None

Vertical alignment.

ma : Optional[Literal["center", "left", "right"] | float] = None

Horizontal Alignment for multiline text.

rotation : Optional[Literal["vertical", "horizontal"] | float | Sequence[Literal["vertical", "horizontal"]] | Sequence[float]] = None

Rotation angle in the range [0, 360]. The rotation is affected by the rotation_mode.

rotation_mode : Literal["default", "anchor"] | None = None

How to do the rotation. If None or "default", first rotate the text then align the bounding box of the rotated text. If "anchor", first align the unrotated text then rotate the text around the point of alignment.

linespacing : float = None

Line spacing

backgroundcolor : Optional[str | tuple[float, float, float] | tuple[float, float, float, float] | Sequence[str | tuple[float, float, float] | tuple[float, float, float, float]]] = None

Background color

margin : Optional[dict[Literal["t", "b", "l", "r", "units"], Any]] = None

Margin around the text. The keys are t, b, l, r and units. The tblr keys are floats. The units is one of pt, lines or in. Not all text themeables support margin parameters and other than the units, only some of the other keys may apply.

kwargs : Any = {}

Parameters recognised by 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.