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:
- 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']
andunits
. The units are one of['pt', 'lines', 'in']
. The units default topt
and the other keys to0
. Not all text themeables support margin parameters and other than theunits
, only some of the other keys may apply.- kwargs
dict
Parameters recognised by
matplotlib.text.Text
- family
Notes
element_text
will accept parameters that conform to the ggplot2 element_text API, but it is preferable the Matplotlib based API described above.