Published
Edited
Apr 21, 2020
1 fork
Insert cell
Insert cell
size = 10
Insert cell
Insert cell
Insert cell
{
const svg = d3.select(DOM.svg(width, height))
const position = 20
//var color = d3.scaleLinear().range([0,1]).domain([0,50]);
var palette = d3.interpolatePlasma; // https://github.com/d3/d3-scale-chromatic
svg.selectAll("rect").data(matrix).enter().append("rect")
.attr("x", d=>d[0]*position)
.attr("y", d=>d[1]*position)
.attr("width", position )
.attr("height", position )
.style("fill", d=>palette(d[2]))
.style("stroke", "white")
yield svg.node();
}

Insert cell
d3 = require("d3@5")
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