Plot.plot({
height: 200,
x: {
label: "hue (degrees)",
ticks: [0, 60, 120, 180, 240, 300, 360],
grid: true
},
y: { label: "luminance" },
insetBottom: 15,
marks: [
Plot.ruleY([0]),
Plot.lineY(data, { x: "h", y: "lum" }),
(_index, scales, _values, { width, height }) =>
Plot.raster({
width: 360,
height: 1,
fill: (h) => {
const [r, g, b] = hsv2rgb(h, 1, 1);
return d3.rgb(r * 255, g * 255, b * 255).formatHex();
}
})
.plot({
width,
height,
x: scales.scales.x,
y: { range: [scales.y(0), scales.y(0) + 15] },
axis: null
})
.querySelector("g")
]
})