Quadmesh Plot#
This example visualizes gridded air temperature data using a quadmesh. It works well with xarray datasets to display continuous variables over a regular 2D grid.
import hvplot.xarray # noqa
import numpy as np
import xarray as xr
np.random.seed(42)
# Irregular grid
x = np.sort(np.random.uniform(0, 10, size=40))
y = np.sort(np.random.uniform(0, 5, size=30))
X, Y = np.meshgrid(x, y)
data = np.sin(X) * np.cos(Y) * 3
ds = xr.Dataset({"value": (["y", "x"], data)}, coords={"y": y, "x": x})
ds.hvplot.quadmesh(
x='x',
y='y',
cmap='viridis',
title='Quadmesh Plot (Bokeh)',
)
import hvplot.xarray # noqa
import numpy as np
import xarray as xr
hvplot.extension('matplotlib')
np.random.seed(42)
# Irregular grid
x = np.sort(np.random.uniform(0, 10, size=40))
y = np.sort(np.random.uniform(0, 5, size=30))
X, Y = np.meshgrid(x, y)
data = np.sin(X) * np.cos(Y) * 3
ds = xr.Dataset({'value': (['y', 'x'], data)}, coords={'y': y, 'x': x})
ds.hvplot.quadmesh(
x='x',
y='y',
cmap='viridis',
title='Quadmesh Plot (Matplotlib)',
)
See also
This web page was generated from a Jupyter notebook and not all
interactivity will work on this website.