Filled contours (contourf)

Filled contour bands via a banded colormap; the result backs a colorbar.

plot 05 contourf

Live figure — pick a tool, then zoom, pan, point-pick or annotate. Nothing is active until a tool is selected.

View this figure’s Vega export ↗ — the raw JSON spec, rendered live by a real Vega engine.

View this figure’s Vega-Lite export ↗ — the raw JSON spec(s), rendered live by a real Vega-Lite engine.

import numpy as np
import plotpress

g = np.linspace(-3, 3, 120)
X, Y = np.meshgrid(g, g)
Z = np.sin(X) * np.cos(Y) + 0.3 * (X + Y)

fig, ax = plotpress.subplots()
cf = ax.contourf(g, g, Z, levels=12, cmap="plasma")
ax.set_title("contourf")
fig.colorbar(cf, ax=ax)

Total running time of the script: (0 minutes 0.295 seconds)

Gallery generated by Sphinx-Gallery