plt_pois = Plot.plot({
width: 700, // or a dynamic value based on `width` variable
height: 400,
color: {
legend: false
},
x: {
label: "x",
axis: true,
labelOffset: 30
},
y: {
label: "P(X = x)",
axis: true
},
style: {
fontSize: 16, // overall font size (tick labels + titles)
fontFamily: "sans-serif"
},
tooltip: {
fill: "#097969",
stroke: "#097969",
opacity: 1,
},
marks: [
Plot.ruleY([0]),
Plot.barY(poispdf,{x: "x", y: "pdf", fill: "#C1E1C1", strokeWidth: 0, opacity: 1,
title: (d) => `P(X=${d.x}) = ${(d.pdf).toPrecision(4)}`}),
Plot.barY(poispdf, {filter: d => d.x <= params_pois[1], x: "x", y: "pdf", fill: "#50C878", opacity: 1,
title: (d) => `P(X=${d.x}) = ${(d.pdf).toPrecision(4)}`})
]
})