# Examples from pyvista.PointSet.threshold_percent
# ================================================

# Apply a 50% threshold filter.
import pyvista as pv
noise = pv.perlin_noise(0.1, (2, 2, 2), (0, 0, 0))
grid = pv.sample_function(
    noise, bounds=[0, 1.0, -0, 1.0, 0, 1.0], dim=(30, 30, 30)
)
threshed = grid.threshold_percent(0.5)
threshed.plot(
    cmap='gist_earth_r',
    show_scalar_bar=False,
    show_edges=True,
)

# Apply a 80% threshold filter.
threshed = grid.threshold_percent(0.8)
threshed.plot(
    cmap='gist_earth_r',
    show_scalar_bar=False,
    show_edges=True,
)

# See Using Common Filters for more examples using a similar filter.

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

