pyvista.TextProperty#

class TextProperty(
theme=None,
color=None,
font_family=None,
orientation=None,
font_size=None,
font_file=None,
shadow=False,
justification_horizontal=None,
justification_vertical=None,
italic=False,
bold=False,
background_color=None,
background_opacity=None,
)[source]#

Define text’s property.

Parameters:
themepyvista.plotting.themes.Theme, optional

Plot-specific theme.

colorpyvista.ColorLike, optional

Either a string, RGB list, or hex color string. For example: color='white', color='w', color=[1.0, 1.0, 1.0], or color='#FFFFFF'. Color will be overridden if scalars are specified.

font_familystr | None, optional

Font family or None.

orientationfloat, optional

Text’s orientation (in degrees).

font_sizeint, optional

Font size.

font_filestr, optional

Font file path.

shadowbool, optional

If enable the shadow.

justification_horizontalstr, optional

Text’s horizontal justification. Should be either “left”, “center” or “right”.

justification_verticalstr, optional

Text’s vertical justification. Should be either “bottom”, “center” or “top”.

italicbool, default: False

Italicises title and bar labels.

boldbool, default: True

Bolds title and bar labels.

background_colorpyvista.Color, optional

Background color of text.

background_opacitypyvista.Color, optional

Background opacity of text.

Examples

Create a text’s property.

>>> from pyvista import TextProperty
>>> prop = TextProperty()
>>> prop.opacity = 0.5
>>> prop.background_color = "b"
>>> prop.background_opacity = 0.5
>>> prop.show_frame = True
>>> prop.frame_color = "b"
>>> prop.frame_width = 10
>>> prop.frame_color
Color(name='blue', hex='#0000ffff', opacity=255)

Methods

TextProperty.enable_shadow()

Enable the shadow.

TextProperty.set_font_file(font_file)

Set the font file.

Attributes

TextProperty.background_color

Background color of text's property.

TextProperty.background_opacity

Background opacity of text's property.

TextProperty.bold

Bold of text's property.

TextProperty.color

Color of text's property.

TextProperty.font_family

Font family.

TextProperty.font_size

Font size.

TextProperty.frame_color

Frame color of text property.

TextProperty.frame_width

Width of the frame.

TextProperty.italic

Italic of text's property.

TextProperty.justification_horizontal

Text's justification horizontal.

TextProperty.justification_vertical

Text's vertical justification.

TextProperty.opacity

Opacity of text's property.

TextProperty.orientation

Text's orientation (in degrees).

TextProperty.show_frame

Visibility of frame.