Published
Edited
Oct 26, 2020
6 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
contoursData = {
const x = d3.scaleLinear()
.domain(d3.extent(data, d => d.x)).nice()
.rangeRound([margin.left, width - margin.right])
const y = d3.scaleLinear()
.domain(d3.extent(data, d => d.y)).nice()
.rangeRound([height - margin.bottom, margin.top])
return d3.contourDensity()
.x(d => x(d.x))
.y(d => y(d.y))
.size([width, height])
.bandwidth(30)
.thresholds(30)
(data)
}
Insert cell
data[0]
Insert cell
data = d3.csv(await "https://raw.githubusercontent.com/holtzy/D3-graph-gallery/master/DATA/data_for_density2d.csv", ({x, y, group}) => ({x: +x, y: +y, group: group}) )
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more