add_bounding_box

Renderer.add_bounding_box(color='grey', corner_factor=0.5, line_width=None, opacity=1.0, render_lines_as_tubes=False, lighting=None, reset_camera=None, outline=True, culling='front')

Add an unlabeled and unticked box at the boundaries of plot.

Useful for when wanting to plot outer grids while still retaining all edges of the boundary.

Parameters
colorstr or sequence, optional

Color of all labels and axis titles. Default white. Either a string, rgb sequence, or hex color string. For example:

  • color='white'

  • color='w'

  • color=[1, 1, 1]

  • color='#FFFFFF'

corner_factorfloat, optional

This is the factor along each axis to draw the default box. Default is 0.5 to show the full box.

line_widthfloat, optional

Thickness of lines.

opacityfloat, optional

Opacity of mesh. Default 1.0 and should be between 0 and 1.

render_lines_as_tubesbool, optional

Show lines as thick tubes rather than flat lines. Control the width with line_width.

lightingbool, optional

Enable or disable directional lighting for this actor.

reset_camerabool, optional

Reset camera position when True to include all actors.

outlinebool

Default is True. when False, a box with faces is shown with the specified culling.

cullingstr, optional

Does not render faces that are culled. Options are 'front' or 'back'. Default is 'front' for bounding box.

Returns
vtk.vtkActor

VTK actor of the floor.

Examples

>>> import pyvista
>>> pl = pyvista.Plotter()
>>> _ = pl.add_mesh(pyvista.Sphere())
>>> _ = pl.add_bounding_box(line_width=5, color='black')
>>> pl.show()
../../../_images/pyvista-Renderer-add_bounding_box-1_00_00.png