Reputation: 8247
I have a following Pandas dataframe named Scores,following is the subset of it
0
0 25.104179
1 60.908747
2 23.222238
3 51.553491
4 22.629690
5 53.338099
6 22.360882
7 26.515078
8 52.737316
9 40.235152
When I plot a histogram it looks like following
Now, I want to plot a distribution on this histogram with mean=37.72 and SD=2.72 I am able to generate a distribution with following code
x= np.linspace(10,90,1000)
y = norm.pdf(x, loc=37.72, scale=2.71) # for example
pylab.plot(x,y)
pylab.show()
How can I embed this on histogram ?
Upvotes: 0
Views: 337
Reputation: 4636
You can do something like this,
plt.hist( The histogram data)
plt.plot( The distribution data )
plt.show()
The plt.show
will show both figures embedded in a single figure.
Upvotes: 1