Interpolate
Fills a regular grid from scattered samples, for a heatmap, contours or a smooth line.
Static preview; loading the interactive plot
<script>
import { Plot, Interpolate, Heatmap } from "hmplot";
const data = {
x: [0, 1, 2, 0, 1, 2, 0.5, 1.5],
y: [0, 0, 0, 2, 2, 2, 1, 1],
temperature: [10, 12, 15, 11, 14, 18, 13, 16],
};
</script>
<Plot {data} height={300} axes2d>
<Interpolate x="x" y="y" values={["temperature"]}>
<Heatmap fill="temperature" />
</Interpolate>
</Plot>
Usage
Outputs coordinates and requested value columns as a grid table (y then x; see Data, “Grid tables”), its 2-D cells tiling the bounds. auto uses linear interpolation in 1D, bilinear for complete rectangular data, and local IDW for scattered 2D samples. Categories always use nearest neighbors. Numeric columns share interpolation geometry.
To let the viewer change a setting, read an input in it: resolution={input("resolution")} (Python resolution=hm.input.resolution), where resolution is a Slider.