Public
Edited
May 14, 2024
Importers
3 stars
Insert cell
Insert cell
Insert cell
arange(5)
Insert cell
arange(5, {dtype:Int32Array})
Insert cell
arange(5, {dtype:Array})
Insert cell
arange(5, {start: 1, step:0.5})
Insert cell
Insert cell
zeros(3)
Insert cell
ones(3)
Insert cell
linspace(0, 1, 6)
Insert cell
linspace(1, 0, 6)
Insert cell
logspace(-2, 3, 6)
Insert cell
geomspace(1e-2, 1e3, 6)
Insert cell
Insert cell
cumsum(arange(5, {dtype:Int32Array}))
Insert cell
cumsum(arange(5, {dtype:Int32Array}), {dtype:Float32Array})
Insert cell
x = linspace(0, 10, 1001)
Insert cell
y = x.map(x => Math.sin(x))
Insert cell
diff(y)
Insert cell
cumsum(y)
Insert cell
argsort(y)
Insert cell
interp([Math.PI / 2, Math.PI / 4], x, y)
Insert cell
// scalar first arg gives a scalar result
interp(1, x, y)
Insert cell
// xp can be decreasing
interp(1, [2,1,0],[5,6,7])
Insert cell
// x can be clipped to the limits of xp
interp([-1,3],[0,1,2],[5,6,7],{clipped:true})
Insert cell
data = Float64Array.from({length: 1000}, a => Math.random());
Insert cell
histogram(data, 10, {range:[0,1]})
Insert cell
histogram(data, 10, {range:[0,1], weights:data.map(x => x**2)})
Insert cell
histogram(data, linspace(0, 1, 11)).hist
Insert cell
{
const data = [0,2,-1,1];
return {max:argmax(data), min:argmin(data)};
}
Insert cell
Insert cell
meshgrid([[-1,1],[-2,0,2]])
Insert cell
meshgrid([[-1,1],[-2,0,2]]).flat(2);
Insert cell
meshgrid([[-1,1],[-2,0,2]], {flat:true, dtype:Float32Array})
Insert cell
meshgrid([new Int32Array([-1,1]), new Int32Array([-2,0,2])])
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

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