1

I look for graphing both normal density and histogram density from a serie df like that but don't achieve. like link below http://hypertextbook.com/facts/2007/resistors/histogram.gif

How to do that with DataFrame objects ?

>>> fd
Scenario
s0000      -2.378963
...
s0999       1.368384
Name: values, Length: 1000, dtype: float64
>>> fd.hist(bins=100)
Alexis G
  • 1,259
  • 3
  • 14
  • 27

2 Answers2

1

I think you can first plot the histogram like fd.hist()

Then fit the normal density and plot it with matplotlob, please refer to:

Fitting a histogram with python

Community
  • 1
  • 1
Vschon
  • 63
  • 4
0
fig = plt.figure()
ax = fig.add_subplot(111)
fd.hist(ax=ax, bins=100)
ax1 = ax.twinx()
fd.plot(kind="kde", ax=ax1, legend=False )

Adapted from https://stackoverflow.com/a/26913361/841830 which shows the more complex case of two histograms and two density plots.

Community
  • 1
  • 1
Darren Cook
  • 27,837
  • 13
  • 117
  • 217