unregister_plotter_component

unregister_plotter_component#

unregister_plotter_component(name: str, target_cls: type | None = None) None[source]#

Remove a component previously attached to a plotter class.

The inverse of register_plotter_component(). Restores any built-in attribute that was shadowed via override=True when the component was registered.

Added in version 0.48.0.

Parameters:
namestr

Namespace of the component to remove.

target_clstype, optional

Target class the component was registered against. Defaults to pyvista.BasePlotter. Only components attached directly on target_cls can be unregistered; a component inherited from a parent class must be unregistered on that parent.

Raises:
ValueError

If no component named name is attached directly to target_cls.

TypeError

If target_cls is not a class, or name is not a string.

Examples

>>> import pyvista as pv
>>> @pv.register_plotter_component('tmp')
... class TmpComponent:
...     def __init__(self, plotter):
...         self._plotter = plotter
>>> pv.unregister_plotter_component('tmp')