plt_pdf = Plot.plot({
width: 700, // or a dynamic value based on `width` variable
height: 400,
color: {
legend: true
},
x: {
label: "x",
axis: true
},
y: {
axis: true,
label: "Normal density value f(x)",
domain: [0,jstat.normal.pdf(params[0], params[0], params[1])]
},
style: {
fontSize: 15, // overall font size (tick labels + titles)
fontFamily: "sans-serif"
},
marks: [
Plot.ruleY([0]),
Plot.line(normpdf, {x: "x", y: "pdf", stroke : "steelblue", strokeWidth: 2}),
Plot.areaY(normpdf, {filter: d => d.x <= params[2], x: "x", y: "pdf", fill: "steelblue", opacity: 0.2})
]
})