# Examples from pyvista.plotting.themes.Theme.interpolate_before_map
# ==================================================================

# Enable hidden line removal.
import pyvista as pv

# Load a cylinder which has cells with a wide spread
cyl = pv.Cylinder(direction=(0, 0, 1), height=2).elevation()

# Common display argument to make sure all else is constant
dargs = dict(scalars='Elevation', cmap='rainbow', show_edges=True)

pl = pv.Plotter(shape=(1, 2))
_ = pl.add_mesh(
    cyl,
    interpolate_before_map=False,
    scalar_bar_args={'title': 'Elevation - interpolated'},
    **dargs,
)
pl.subplot(0, 1)
_ = pl.add_mesh(
    cyl,
    interpolate_before_map=True,
    scalar_bar_args={'title': 'Elevation - interpolated'},
    **dargs,
)
pl.link_views()
pl.camera_position = pv.CameraPosition(
    position=(-1.67, -5.10, 2.06),
    focal_point=(0.0, 0.0, 0.0),
    viewup=(0.00, 0.37, 0.93),
)
pl.show()

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

