{
const random = d3.randomLcg(50);
const stop = (V) => {
let stopped = false;
return V.map((d) =>
stopped || d < -Math.log(100) ? ((stopped = true), -Math.log(100)) : d
);
};
return Plot.plot({
y: {
type: "log",
transform: (d) => Math.exp(d) * 100,
domain: [1, Math.exp(33)],
label: "↑ radius",
grid: true
},
marks: [
Plot.lineY(
Array.from({ length: 10000 }, () =>
Math.log(f(random() * 2 * Math.PI))
),
Plot.mapY(
stop,
Plot.mapY("cumsum", {
y: (d) => d,
strokeWidth: 0.75,
x: (d, i) => i % 1000,
stroke: (d, i) => (i / 1000) | 0
})
)
),
Plot.tickY([0, -Math.log(100)])
]
});
}