# Examples from pyvista.DataSetFilters.clip_scalar
# ================================================

# Remove the part of the mesh with `sample_point_scalars` above 100.
import pyvista as pv
from pyvista import examples
dataset = examples.load_hexbeam()
clipped = dataset.clip_scalar(scalars='sample_point_scalars', value=100)
clipped.plot()

# Get clipped meshes corresponding to the portions of the mesh above and below 100.
import pyvista as pv
from pyvista import examples
dataset = examples.load_hexbeam()
_below, _above = dataset.clip_scalar(
    scalars='sample_point_scalars', value=100, both=True
)

# Remove the part of the mesh with `sample_point_scalars` below 100.
import pyvista as pv
from pyvista import examples
dataset = examples.load_hexbeam()
clipped = dataset.clip_scalar(
    scalars='sample_point_scalars', value=100, invert=False
)
clipped.plot()

# Clip the part of the mesh with `sample_point_scalars` between 200 and 250.
import pyvista as pv
from pyvista import examples
dataset = examples.load_hexbeam()
clipped = dataset.clip_scalar(
    scalars='sample_point_scalars', value=(200, 250)
)
clipped.plot()

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code
