Skip to content
Advertisement

Issue with plotting normal distribution curve with available set of values

enter image description hereI’m trying to plot a normal distribution curve for a set of values. Unfortunately, the below code (taken from this post) doesn’t seem to be plotting the curve correctly over the histograms (please refer attached image). I’m sure I’m missing something or have done something silly but can’t seem to figure out. Can someone please help? I’ve included my code below – I’m getting the values from a dataframe but have included these as a list s for convenience:

JavaScript

Advertisement

Answer

You have set mu and sigma arbitrarily to 0 and 1 respectively but you should calculate it for your actual data:

JavaScript


Update with full working example:
JavaScript

enter image description here

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement