pyvista.plotting.widgets.WidgetHelper.add_mesh_threshold#
- WidgetHelper.add_mesh_threshold(
- mesh,
- scalars=None,
- invert=False,
- widget_color=None,
- preference='cell',
- title=None,
- pointa=(0.4, 0.9),
- pointb=(0.9, 0.9),
- continuous=False,
- all_scalars=False,
- method='upper',
- **kwargs,
Apply a threshold on a mesh with a slider.
Add a mesh to the scene with a slider widget that is used to threshold the mesh interactively.
The threshold mesh is saved to the
.threshold_meshes
attribute on the plotter.- Parameters:
- mesh
pyvista.DataSet
orvtk.vtkAlgorithm
The input dataset to add to the scene and threshold or algorithm that produces said mesh.
- scalars
str
,optional
The string name of the scalars on the mesh to threshold and display.
- invertbool, default:
False
Invert the threshold results. That is, cells that would have been in the output with this option off are excluded, while cells that would have been excluded from the output are included.
- widget_color
ColorLike
,optional
Color of the widget. Either a string, RGB sequence, or hex color string. For example:
color='white'
color='w'
color=[1.0, 1.0, 1.0]
color='#FFFFFF'
- preference
str
, default: ‘cell’ When
mesh.n_points == mesh.n_cells
and setting scalars, this parameter sets how the scalars will be mapped to the mesh. Default'cell'
, causes the scalars to be associated with the mesh cells. Can be either'point'
or'cell'
.- title
str
,optional
The string label of the slider widget.
- pointasequence, default: (0.4, 0.9)
The relative coordinates of the left point of the slider on the display port.
- pointbsequence, default: (0.9, 0.9)
The relative coordinates of the right point of the slider on the display port.
- continuousbool, default:
False
If this is enabled (default is
False
), use the continuous interval[minimum cell scalar, maximum cell scalar]
to intersect the threshold bound, rather than the set of discrete scalar values from the vertices.- all_scalarsbool, default:
False
If using scalars from point data, all points in a cell must satisfy the threshold when this value is
True
. WhenFalse
, any point of the cell with a scalar value satisfying the threshold criterion will extract the cell. Has no effect when using cell data.- method
str
, default: ‘upper’ Set the threshold method for single-values, defining which threshold bounds to use. If the
value
is a range, this parameter will be ignored, extracting data between the two values. For single values,'lower'
will extract data lower than thevalue
.'upper'
will extract data larger than thevalue
.- **kwargs
dict
,optional
All additional keyword arguments are passed to
add_mesh
to control how the mesh is displayed.
- mesh
- Returns:
vtk.vtkActor
VTK actor of the mesh.