Published
Edited
May 5, 2020
6 forks
40 stars
Insert cell
Insert cell
Insert cell
Insert cell
mu = Math.log(11.4)
Insert cell
sigma = 0.2
Insert cell
x = jStat.seq(0.01, 30, 1001)
Insert cell
y = (x => jStat.lognormal.pdf(x, mu, sigma))
Insert cell
density_data = x.map(d => ({'x': d, 'y': y(d)}))
Insert cell
Insert cell
xScale = d3
.scaleLinear()
.domain(d3.extent(density_data, d => d.x))
.rangeRound([0, width])
.nice()
Insert cell
yScale = d3.scaleLinear().domain(d3.extent(density_data, d => d.y)).rangeRound([height, 0])
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
p_less_than_x = jStat.seq(1/n_quantiles / 2, 1 - (1/n_quantiles / 2), n_quantiles)
Insert cell
quantiles = p_less_than_x.map(d => ({'p_less_than_x': d, 'x': jStat.lognormal.inv( d, mu, sigma )}))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
qfStacks = generateDotplotStacks(quantiles.map(c => c.x), qBinwidth)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import { kde, epanechnikov } from "@d3/kernel-density-estimation"
Insert cell
import {slider} from "@jashkenas/inputs"
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