pyvista.Plotter.add_light#

Plotter.add_light(light, only_active=False)[source]#

Add a Light to the scene.

Parameters:
lightLight or vtkLight

The light to be added.

only_activebool, default: False

If True, only add the light to the active renderer. The default is that every renderer adds the light. To add the light to an arbitrary renderer, see pyvista.Renderer.add_light().

Examples

Create a plotter that we initialize with no lights, and add a cube and a single headlight to it.

>>> import pyvista as pv
>>> plotter = pv.Plotter(lighting='none')
>>> _ = plotter.add_mesh(pv.Cube())
>>> light = pv.Light(color='cyan', light_type='headlight')
>>> plotter.add_light(light)
>>> plotter.show()
../../../_images/pyvista-Plotter-add_light-1_00_00.png