{
const p = Plot.plot({
marginRight: 200,
width: 800,
marks: [
Plot.dot(penguins, {
x: "culmen_length_mm",
y: "culmen_depth_mm",
stroke: "species"
})
]
});
const legend = p.legend("color");
const d = d3.select(p).append("foreignObject")
.attr("width", 280)
.attr("height", 200)
.attr("x", 540)
.attr("y", 320)
.append("xhtml:div")
.html(`
<span style="font-family: sans-serif; font-size: 12px; font-weight: bold">
Species
</span>` + legend.outerHTML);
return p;
}