Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Distplot fix #473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 27, 2016
Merged

Distplot fix #473

merged 9 commits into from
May 27, 2016

Conversation

yankev
Copy link
Contributor

@yankev yankev commented May 20, 2016

Fixes issue #459
screen shot 2016-05-20 at 2 45 18 pm

@yankev
Copy link
Contributor Author

yankev commented May 20, 2016

  • Going to include a keyword argument to swap between the new way (where histnorm = 'probability density'), and the original (histnorm = 'probability')
  • Need to add new tests for this functionality

@yankev
Copy link
Contributor Author

yankev commented May 25, 2016

@Kully @cldougl @theengineear @empet
Added an extra parameter called histnorm to deal with the two different types of distplots (the seaborn-like method/the original and probability density method)
I've kept the default for histnorm as probability for backwards compatibility.

@@ -4019,7 +4019,7 @@ def create_candlestick(open, high, low, close,
@staticmethod
def create_distplot(hist_data, group_labels,
bin_size=1., curve_type='kde',
colors=[], rug_text=[],
colors=[], rug_text=[], histnorm='probability',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yankev can you add that param to the docstring as well (so around line 4039)

@empet
Copy link

empet commented May 25, 2016

@yankev The seaborn distplot is equivalent to plotly distplot corresponding to histnorm=probability density. Leaving the default as probability it's not a good idea because a lot of plots on Plotly cloud used wrong this key and people that take as examples these older plots can think that this version leads to a histogram comparable with an estimate of the probbaility density associated to data.

@empet
Copy link

empet commented May 26, 2016

@yankev Here is the proof that seaborn distplot works like Plotly distplot with histnorm=probability density (see the last plot):http://nbviewer.jupyter.org/gist/empet/1bf38aea056f1d60481e600fc68c21be?flush_cache=true

@yankev
Copy link
Contributor Author

yankev commented May 26, 2016

@empet oh I see, thanks. Initially I was trying to keep some backwards compatibility, but it appears as though setting histnorm = 'probability density' is the correct approach.

@empet
Copy link

empet commented May 26, 2016

@yankev Yes, this is the recommended default value for histnorm in distplot.

@@ -5108,7 +5111,9 @@ def make_kde(self):
self.curve_y[index] = (scipy.stats.gaussian_kde
(self.hist_data[index])
(self.curve_x[index]))
self.curve_y[index] *= self.bin_size[index]

if self.histnorm == 'probability':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pull these into constants at the top of the file? Hard-coded things like this always raise 🚨's for me.

@theengineear
Copy link
Contributor

@yankev tests look great, thanks for adding those! 💃 me after pulling those histnorm values out into some constants somewhere!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants