How do I get a smooth outline (with filled area) for this plot?

92 Views Asked by At

PDF from histogram data PDF from histogram data

I am trying to get a PDF with a smoother outline. Also, the area under the curve must be filled. How can I get the curve of best fit for this?

This is the code I have used.

plt.hist(
    data,
    range=[0, 60],
    bins=60,
    density=True,
    label="In bulk",
    histtype="stepfilled",
    alpha=0.5,
)
1

There are 1 best solutions below

0
J. M. Arnold On

Your description is vague, but as far as I understood you want to fill everything under the line each bar is spanning!

You can use .fill_between for that! Refer to the documentation.