pyvista.Plotter.add_title#

Plotter.add_title(title, font_size=18, color=None, font=None, shadow=False)[source]#

Add text to the top center of the plot.

This is merely a convenience method that calls add_text with position='upper_edge'.

Parameters:
titlestr

The text to add the rendering.

font_sizefloat, default: 18

Sets the size of the title font.

colorColorLike, optional

Either a string, rgb list, or hex color string. Defaults to white or the value of the global theme if set. For example:

  • color='white'

  • color='w'

  • color=[1.0, 1.0, 1.0]

  • color='#FFFFFF'

fontstr, optional

Font name may be 'courier', 'times', or 'arial'.

shadowbool, default: False

Adds a black shadow to the text.

Returns:
vtk.vtkTextActor

Text actor added to plot.

Examples

>>> import pyvista as pv
>>> pl = pv.Plotter()
>>> pl.background_color = 'grey'
>>> actor = pl.add_title(
...     'Plot Title', font='courier', color='k', font_size=40
... )
>>> pl.show()
../../../_images/pyvista-Plotter-add_title-1_00_00.png