add_title

Plotter.add_title(title, font_size=18, color=None, font=None, shadow=False)

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, optional

Sets the size of the title font. Defaults to 16 or the value of the global theme if set.

colorstr or 3 item list, 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, 1, 1]

  • color='#FFFFFF'

fontstr, optional

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

shadowbool, optional

Adds a black shadow to the text. Defaults to False.

Returns
vtk.vtkTextActor

Text actor added to plot.

Examples

>>> import pyvista
>>> pl = pyvista.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