Themes#
PyVista plotting parameters can be controlled on a plot by plot basis or through a global theme, making it possible to control mesh colors and styles through one global configuration.
The DocumentTheme is the default theme for PyVista. Theme
provides a theme that is similar to the default styling of VTK.
See Control Global and Local Plotting Themes for an example on how to use themes within PyVista.
Dark mode theme. |
|
Base VTK theme. |
|
A document theme well suited for papers and presentations. |
|
A paraview-like theme. |
|
PyVista axes configuration. |
|
PyVista camera configuration. |
|
PyVista colorbar configuration. |
|
PyVista depth peeling configuration. |
|
PyVista plotter font configuration. |
|
PyVista lighting configuration. |
|
PyVista silhouette configuration. |
|
PyVista configuration encompassing all slider styles. |
|
PyVista configuration for a single slider style. |
|
PyVista Trame configuration. |
Custom Interactor Styles#
Themes can also choose the default interactor style by name through
Theme.interactor_style. Downstream packages can register
additional style names programmatically or through the
pyvista.interactor_styles entry-point group.
- register_interactor_style(name: str, handler: InteractorStyleHandler) None[source]#
Register a custom interactor style.
- Parameters:
- name
str Name of the interactor style. Built-in PyVista styles use names that mirror the public
enable_*_styleAPI, such as'terrain_style'.- handler
callable() Handler for the interactor style. This can be a vtkInteractorStyle subclass (instantiated automatically) or any callable with signature
handler(interactor)that returns an interactor style instance.
- name
- Raises:
ValueErrorIf
nameis empty or collides with a built-in PyVista interactor style.
Examples
Register a vtkInteractorStyle subclass directly and use it from a theme.
>>> import pyvista as pv >>> from vtkmodules.vtkInteractionStyle import ( ... vtkInteractorStyleFlight, ... ) >>> pv.register_interactor_style( ... 'flight_style', vtkInteractorStyleFlight ... ) >>> pv.global_theme.interactor_style = 'flight_style'
A callable that takes the interactor as an argument can also be registered.
>>> def custom_style(interactor): ... >>> pv.register_interactor_style( ... 'custom_style', custom_style ... )