Plot.plot({
color: {
legend: true
},
x: {
label: "Horsepower →"
},
y: {
label: " ↑0-60mph in sec",
grid: true
},
marks: [
Plot.dot(cars, {
x: "power (hp)",
y: "0-60 mph (s)",
r: "power (hp)",
fill: "power (hp)"
}),
Plot.text(cars, {
x: "power (hp)",
y: "0-60 mph (s)",
text: (d) => (d["power (hp)"] > 200 ? d["name"] : ""),
fontSize: 10
}),
Plot.linearRegressionY(cars, {
x: "power (hp)",
y: "0-60 mph (s)",
stroke: "red",
ci: 0.95
})
]
})