0

I am trying to plot density plot through Python. So far I am using this code:

for s in data_Pre1.columns:
    data_Pre1[s].plot(kind='kde', normed = True)
plt.title("Disk Galaxies", fontsize = 18)
plt.xlabel("$E_i$", fontsize = 18)
plt.ylabel('Number of images', fontsize = 18)
plt.xlim(-1,1)
plt.ylim(0.1,1.0)
plt.legend(fontsize =18)
plt.show()

I have two columns in my datasets. I am getting y-lims from 0-4. But most of the density plots has limits in points like 0.1 to 1.0 in order to shows percentages. I am not sure why I am getting 0-4 and I can interpret it.

Thanks in advanceDensity plots of two variables simultaneously

  • Please clarify your question. There is no question in your question. – rpoleski May 14 '20 at 12:59
  • a probability density function just needs to be positive and integrate to 1. hence having values of 4 is fine. it's common to not include y tick labels, see for example the plots on the wikipedia page of [PDF](https://en.wikipedia.org/wiki/Probability_density_function)s – Sam Mason May 14 '20 at 13:05
  • See these questions: https://stackoverflow.com/questions/38141951/why-does-scipy-norm-pdf-sometimes-give-pdf-1-how-to-correct-it https://stackoverflow.com/questions/61091824/scipy-normal-distribution-with-scale-greater-and-less-than-1/61091961#61091961 – Arne May 14 '20 at 13:16

0 Answers0