{
const lin = (x) => x / (4 * Math.PI);
const { sin, cos } = Math;
return Plot.plot({
width: 450,
height: 420,
color: { type: "diverging" },
fx: { tickFormat: (f) => f?.name },
fy: { tickFormat: (f) => f?.name },
marks: [
Plot.raster({
fill: (x, y, { fx, fy }) => fx(x) * fy(y),
fx: [sin, sin, lin, lin],
fy: [cos, lin, lin, cos],
x1: 0,
y1: 0,
x2: 4 * Math.PI,
y2: 4 * Math.PI,
interval: 0.2
}),
Plot.frame()
]
});
}