plt_pdf = Plot.plot({
width: 800, // or a dynamic value based on `width` variable
height: 600,
style: {fontSize: "15px"},
color: {
legend: true
},
x: {
label: "x",
axis: true
},
y: {
label: "f(x)",
//axis: false,
domain: [0,jstat.chisquare.pdf(Math.max(0,params[0]-2), params[0])]
},
marks: [
Plot.ruleY([0]),
Plot.ruleX([0]),
Plot.line(chisquarepdf, {x: "x", y: "pdf", stroke : "steelblue", strokeWidth: 2}),
Plot.areaY(chisquarepdf, {filter: d => d.x <= params[1], x: "x", y: "pdf", fill: "steelblue", opacity: 0.2})
]
})