# Examples from pyvista.PolyDataFilters.decimate
# ==============================================

# Decimate a sphere.  First plot the sphere.
import pyvista as pv
sphere = pv.Sphere(phi_resolution=60, theta_resolution=60)
sphere.plot(show_edges=True, line_width=2)

# Now decimate it by 75% and plot it.
decimated = sphere.decimate(0.75)
decimated.plot(show_edges=True, line_width=2)

# Decimate taking scalars attributes into account:
decimated = sphere.decimate(0.5, scalars=True)

# Decimate taking all attributes except normals into account:
decimated = sphere.decimate(
    0.5, enable_all_attribute_error=True, normals=False
)

# See Decimation for more examples using this filter.

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

