pyvista.Renderer.add_bounding_box

pyvista.Renderer.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',
)[source]#

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:
colorColorLike, default: “grey”

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.0, 1.0, 1.0]

  • color='#FFFFFF'

corner_factorfloat, default: 0.5

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, default: 1.0

Opacity of mesh. Should be between 0 and 1.

render_lines_as_tubesbool, default: False

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: True

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

cullingstr, default: “front”

Does not render faces on the bounding box that are culled. Options are 'front' or 'back'.

Returns:
vtk.vtkActor

VTK actor of the bounding box.

See also

pyvista.DataSetFilters.bounding_box

Create a bounding box or oriented bounding box for a dataset.

Examples

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