plot_digit = (n) =>
Plot.plot({
x: { axis: false },
y: { axis: false },
width: 58,
height: 58,
marks: [
Plot.cell(
Object.values(mnist_digits[n])
.slice(2)
.map((c, i) => ({ x: i % 28, y: Math.floor(i / 28), c })),
{
x: "x",
y: "y",
fill: (o) => d3.interpolateGreys(o.c / 255),
stroke: (o) => d3.interpolateGreys(o.c / 255)
}
)
]
})