Public
Edited
Nov 14, 2024
2 forks
22 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
nGroups = Math.round(d3.randomUniform(2,15)())
Insert cell
Insert cell
nBlots = Math.round(d3.randomUniform(2,15)())
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
opacityScale = d3.scaleLinear()
.range([.75,1])
.domain([0,1])
Insert cell
transparent = (color, alpha) => {
const rgb = d3.rgb(color);
return "rgba(" + [rgb.r, rgb.g, rgb.b, alpha].join(",") + ")";
}
Insert cell
y = d3.scaleLinear()
.range([height - 100, 100])
.domain([0, 1])
Insert cell
sizeScale = d3.scalePow()
.exponent(10)
.domain([0,1])
.range([1, 50])
Insert cell
colorScale = d3.scaleOrdinal()
.range(["black","red"])
.domain([0, 1])
Insert cell
jitter = {
return function jitter(deg) {
const firstVal = Math.random()*deg;
const secondVal = Math.random();
const thirdVal = (secondVal > .5 ? -1 : 1)
return firstVal * thirdVal;
}
}
Insert cell
x = d3.scaleLinear()
.range([0, width/2])
.domain([0, 1 ])
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