Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seaborn: Remove fit from distplot

I'm trying to plot a distribution with distplot(), and I want

  1. absolute numbers instead of relative frequency on the y axis
  2. no fitted function

I thought that (1) could be achieved by setting norm_hist=False, but still, relative frequencies are shown on the y axis:

First try

But no problem, I can work around that by directly setting the 'normed' keyword of the underlying pyplot.hist graph:

Second try

However, now I have the problem that the fitted function (created with pyplot.plot) still works on the normalized values and thus is somewhere on the bottom of the graph. I would like to completely get rid of the fitted plot. How do I do that? I thought setting fit=None would do the trick, but as you can see, it doesn't.

Any help is appreciated!

Lukas

like image 742
Lukas Barth Avatar asked Sep 29 '17 11:09

Lukas Barth


1 Answers

The line you call "fit" is a kernel density estimate (KDE), it only makes sense for a normalized plot (as it is a probability density function).

To get rid of the kde curve, you may use the kde=False keyword argument.

distplot( ... , kde=False)
like image 95
ImportanceOfBeingErnest Avatar answered Oct 07 '22 12:10

ImportanceOfBeingErnest