Public
Edited
Jan 23, 2023
1 fork
7 stars
Insert cell
Insert cell
Insert cell
plot = {
steely_dan_says;
let f = (x) => Math.exp(-(x ** 2 / 2)) * Math.sin(20 * x);
let plot = Plot.plot({
width: 900,
height: 300,
y: { domain: [-1.2, 1.2] },
marks: [
Plot.line(
d3.range(-3.2, 3.2, 0.01).map((x) => [x, f(x)]),
{ strokeWidth: 3 }
)
]
});
let path = d3.select(plot).select("g[aria-label='line']").select("path");
let length = path.node().getTotalLength();
path
.attr("stroke-dasharray", [0, length])
.transition()
.duration(1500)
.attr("stroke-dasharray", [length, length]);
return plot;
}
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