plotnine.element_text
element_text(=None,
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={}
kwargs )
Theme element: Text
Parameters
family : str | list[str] | None = None
-
Font family. See
set_family
for supported values. style : str | Sequence[str] | None = None
-
Font style
color : str | tuple[float, float, float] | tuple[float, float, float, float] | Sequence[str | tuple[float, float, float] | tuple[float, float, float, float]] | None = None
-
Text color
weight : int | str | Sequence[int | str] | None = None
-
Should be one of
normal
,bold
,heavy
,light
,ultrabold
orultralight
. size : float | Sequence[float] | None = None
-
text size
ha : Literal["center", "left", "right"] | float | None = None
-
Horizontal Alignment.
va : Literal["center", "top", "bottom", "baseline", "center_baseline"] | float | None = None
-
Vertical alignment.
ma : Literal["center", "left", "right"] | float | None = None
-
Horizontal Alignment for multiline text.
rotation : Literal["vertical", "horizontal"] | float | Sequence[Literal["vertical", "horizontal"]] | Sequence[float] | None = None
-
Rotation angle in the range [0, 360]. The
rotation
is affected by therotation_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 : str | tuple[float, float, float] | tuple[float, float, float, float] | Sequence[str | tuple[float, float, float] | tuple[float, float, float, float]] | None = None
-
Background color
margin : Margin | dict[Literal["t", "b", "l", "r", "unit"], Any] | None = None
-
Margin around the text. The keys are
t
,b
,l
,r
andunits
. Thetblr
keys are floats. Theunit
is one ofpt
,lines
orin
. Not all text themeables support margin parameters and other than theunits
, 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.