Home > OS >  How to make line plot following histogram bins in python
How to make line plot following histogram bins in python

Time:03-30

I am trying to make a hist plot with number of bins. After that I want to draw a line plot following bins but I am not able to draw line plot. Can I get some help?

plt.hist(df1_small['fz'], bins=[-5, -4.5, -4, -3.5, -3,-2.5,-2,-1.5,-1,-0.5,0, 0.5, 1,1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5])
sns.kdeplot(df1_small['fz'],fill=True, color = 'Red') 
df1_small['fz'].plot(kind = "kde")
plt.xlabel('Distribution of fz of small particles')
plt.xlim(-5, 5)
plt.show()

This is my code. Plot I got is like this:

enter image description here

If you noticed, line plot is kind of straight line only in 0.

How can I draw line following all bins?

Data is here:


If you're trying to overlay a

  • Related