plotnine.themes.element_text

class plotnine.themes.element_text(family=None, style=None, weight=None, color=None, size=None, ha=None, va=None, rotation=None, linespacing=None, backgroundcolor=None, margin=None, **kwargs)[source]

Theme element: Text

Parameters:
family : str

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

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

Font style

color : str | tuple

Text color

weight : str

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

size : float

text size

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

Horizontal Alignment.

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

Vertical alignment.

rotation : float

Rotation angle in the range [0, 360]

linespacing : float

Line spacing

backgroundcolor : str | tuple

Background color

margin : 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 will a.

kwargs : 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.