Plot.plot({
x: { label: "time period",
ticks: [0,1,2,3],
tickFormat: x=> ['0','1','2','3'] [x/1]
},
y: { label: "cash flows",
ticks: [-10, 0,5,15]
},
marks: [
Plot.lineY(data2, {
x: "year",
y: "cashFlow",
tip: false
}),
Plot.dotY(data, {
x: "year",
y: "cash flows",
fill: (d) => (d.cashflow > 0 ? "blue" : "red"),
tip: true
})
]
})