Plot.plot({
y: { grid: true },
x: { grid: true, label: "Threshold" },
marks: [
Plot.lineY(data, {
x: "threshold",
y: "fp_cost",
tip: true,
stroke: "red",
strokeWidth: 3
}),
Plot.lineY(data, {
x: "threshold",
y: "fn_cost",
tip: true,
stroke: "darkblue",
strokeWidth: 3
}),
Plot.lineY(data, {
x: "threshold",
y: "total_savings",
tip: true,
stroke: "green",
strokeWidth: 3
}),
Plot.dot(["fp_cost", "fn_cost", "total_savings"], {
x: () => data[i].threshold,
y: (d) => data[i][d],
fill: "black",
r: 5
}),
Plot.ruleY([0], { strokeWidth: 5 })
]
})