Back to D3

d3-contour

docs/d3-contour.md

7.9.01.0 KB
Original Source
<script setup> import * as Plot from "@observablehq/plot"; import {data as volcano} from "./data/volcano.data.js"; import PlotRender from "./components/PlotRender.js"; </script>

d3-contour

<div style="margin: 1em 0;"> <PlotRender :options='{ axis: null, aspectRatio: 1, style: "margin: 0;", marks: [ Plot.contour(volcano.values, { width: volcano.width, height: volcano.height, fill: Plot.identity, stroke: "black", interval: 5 }) ] }' /> <a href="https://observablehq.com/@d3/volcano-contours/2" style="font-size: smaller;" target="_blank">Fork ↗︎</a> </div>

This module computes contour polygons by applying marching squares to a rectangular grid of numeric values. For example, the contours above show the topography of Maungawhau.

See one of: