add_bounding_box#
- Plotter.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
- color
color_like
,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.0, 1.0, 1.0]
color='#FFFFFF'
- corner_factor
float
,optional
This is the factor along each axis to draw the default box. Default is 0.5 to show the full box.
- line_width
float
,optional
Thickness of lines.
- opacity
float
,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
. whenFalse
, a box with faces is shown with the specified culling.- culling
str
,optional
Does not render faces that are culled. Options are
'front'
or'back'
. Default is'front'
for bounding box.
- color
- Returns
vtk.vtkActor
VTK actor of the bounding box.
Examples
>>> import pyvista >>> pl = pyvista.Plotter() >>> _ = pl.add_mesh(pyvista.Sphere()) >>> _ = pl.add_bounding_box(line_width=5, color='black') >>> pl.show()