Plot.plot({
width: width,
marks: [
Plot.dot(
cars.filter((d) => d.cylinders == 8),
{ x: "economy (mpg)", y: "power (hp)" }
),
new Textbox(oneCar, {
x: (d) => d["economy (mpg)"] + 0.2,
y: (d) => d["power (hp)"] + 6,
text: (d) =>
`<img height=32 src="https://www.motortrend.com/uploads/makes/cadillac.png"/><br/>The <b style="color: maroon">${d.name}</b><br/>has <code style='font-size: 8pt'>${d.cylinders}</code> cylinders, and<br/> <i>was made in</i> '${d.year}.`
}),
new Textbox(hpCar, {
x: (d) => d["economy (mpg)"] - 0.2,
y: (d) => d["power (hp)"] + 6,
text: (d) =>
`
<div style="display: flex">
<div><img height=64 src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/8f/Pontiac_logo_and_wordmark_1981.svg/253px-Pontiac_logo_and_wordmark_1981.svg.png"/></div>
<div>
The <b style="color: maroon">${d.name}</b><br/>has <code style='font-size: 8pt'>${d.cylinders}</code> cylinders, and<br/> <i>was made in</i> '${d.year}.
</div>
</div>`
})
]
})