Curvilinear pcolormesh

A warped (2-D X/Y) grid, scan-converted to a single image in pure NumPy.

plot 06 curvilinear mesh

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

n = 50
r = np.linspace(0.3, 1.0, n)
th = np.linspace(0, 1.7 * np.pi, n)
R, TH = np.meshgrid(r, th)
X, Y = R * np.cos(TH), R * np.sin(TH)     # 2-D node coordinates
C = np.sin(4 * TH) * R

fig, ax = plotpress.subplots(figsize=(6, 6))
m = ax.pcolormesh(X, Y, C, cmap="plasma")
ax.set_aspect("equal")
ax.set_title("curvilinear pcolormesh")
fig.colorbar(m, ax=ax)

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

Gallery generated by Sphinx-Gallery