scatter_plot_with_image_tooltips = {
let plot = Plot.plot({
marks: [
Plot.dot(favorability, {
fill: "black",
x: "First Inauguration Date",
y: (d) => metric.value(d) / 100,
title: (d, i) => i
})
]
});
d3.select(plot)
.selectAll("circle")
.nodes()
.forEach(function (c) {
let idx = parseInt(d3.select(c).select("title").text());
let p = favorability[idx];
let content = `<div><h2>${p.Name}</h2><img src="${p["Portrait URL"]}"></div>`;
console.log(content);
tippy(c, {
content: content,
theme: "light",
allowHTML: true
});
d3.select(c).select("title").remove();
});
return plot;
}