plotnine.themes.element_text

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

Theme element: Text

Parameters
familypython:str

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

stylepython:str in ['normal', 'italic', 'oblique']

Font style

colorpython:str | python:tuple

Text color

weightpython:str

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

sizepython:float

text size

hapython:str in ['center', 'left', 'right']

Horizontal Alignment.

vapython:str in ['center' , 'top', 'bottom', 'baseline']

Vertical alignment.

rotationpython:float

Rotation angle in the range [0, 360]

linespacingpython:float

Line spacing

backgroundcolorpython:str | python:tuple

Background color

marginpython:dict

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.

kwargspython:dict

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.