From c2c1f18713d2ad526c55a75b3a7e1db566fd0e61 Mon Sep 17 00:00:00 2001 From: yankev Date: Fri, 20 May 2016 12:43:53 -0400 Subject: [PATCH 1/9] changed histnorm to prob-density and adjusted both types of curves --- plotly/tools.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plotly/tools.py b/plotly/tools.py index 0f71d950e85..d13d66c9526 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -5081,7 +5081,7 @@ def make_hist(self): x=self.hist_data[index], xaxis='x1', yaxis='y1', - histnorm='probability', + histnorm='probability density', name=self.group_labels[index], legendgroup=self.group_labels[index], marker=dict(color=self.colors[index]), @@ -5108,7 +5108,7 @@ 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] + # self.curve_y[index] *= self.bin_size[index] for index in range(self.trace_number): curve[index] = dict(type='scatter', @@ -5143,7 +5143,7 @@ def make_normal(self): / 500 for x in range(500)] self.curve_y[index] = scipy.stats.norm.pdf( self.curve_x[index], loc=mean[index], scale=sd[index]) - self.curve_y[index] *= self.bin_size[index] + # self.curve_y[index] *= self.bin_size[index] for index in range(self.trace_number): curve[index] = dict(type='scatter', @@ -5621,4 +5621,3 @@ def make_table_annotations(self): font=dict(color=font_color), showarrow=False)) return annotations - From ada8147aeff310f15aca7437ea249d15ed56a1c6 Mon Sep 17 00:00:00 2001 From: yankev Date: Fri, 20 May 2016 13:58:14 -0400 Subject: [PATCH 2/9] fixed tests to comply with change to histnorm (-> probability density) --- plotly/tests/test_optional/test_figure_factory.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plotly/tests/test_optional/test_figure_factory.py b/plotly/tests/test_optional/test_figure_factory.py index 5eff6b2c16a..efce6946513 100644 --- a/plotly/tests/test_optional/test_figure_factory.py +++ b/plotly/tests/test_optional/test_figure_factory.py @@ -63,7 +63,7 @@ def test_simple_distplot(self): self.assertEqual(dp['layout'], expected_dp_layout) expected_dp_data_hist = {'autobinx': False, - 'histnorm': 'probability', + 'histnorm': 'probability density', 'legendgroup': 'distplot', 'marker': {'color': 'rgb(31, 119, 180)'}, 'name': 'distplot', @@ -120,7 +120,7 @@ def test_distplot_more_args(self): self.assertEqual(dp['layout'], expected_dp_layout) expected_dp_data_hist_1 = {'autobinx': False, - 'histnorm': 'probability', + 'histnorm': 'probability density', 'legendgroup': '2012', 'marker': {'color': 'rgb(31, 119, 180)'}, 'name': '2012', @@ -136,7 +136,7 @@ def test_distplot_more_args(self): self.assertEqual(dp['data'][0], expected_dp_data_hist_1) expected_dp_data_hist_2 = {'autobinx': False, - 'histnorm': 'probability', + 'histnorm': 'probability density', 'legendgroup': '2013', 'marker': {'color': 'rgb(255, 127, 14)'}, 'name': '2013', @@ -165,7 +165,7 @@ def test_distplot_binsize_array(self): bin_size=[.2, .2]) expected_dp_data_hist_1 = {'autobinx': False, - 'histnorm': 'probability', + 'histnorm': 'probability density', 'legendgroup': '2012', 'marker': {'color': 'rgb(31, 119, 180)'}, 'name': '2012', @@ -181,7 +181,7 @@ def test_distplot_binsize_array(self): self.assertEqual(dp['data'][0], expected_dp_data_hist_1) expected_dp_data_hist_2 = {'autobinx': False, - 'histnorm': 'probability', + 'histnorm': 'probability density', 'legendgroup': '2013', 'marker': {'color': 'rgb(255, 127, 14)'}, 'name': '2013', From 1245b10b390608d1c9e9ae9e7ce8fe74ed65fb60 Mon Sep 17 00:00:00 2001 From: yankev Date: Fri, 20 May 2016 14:49:57 -0400 Subject: [PATCH 3/9] added line back at the end of the file --- plotly/tools.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plotly/tools.py b/plotly/tools.py index d13d66c9526..102676ce65b 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -5621,3 +5621,4 @@ def make_table_annotations(self): font=dict(color=font_color), showarrow=False)) return annotations + From b28b4a227c25a0dfbe0e24fc83d93345316dc458 Mon Sep 17 00:00:00 2001 From: yankev Date: Fri, 20 May 2016 15:42:18 -0400 Subject: [PATCH 4/9] added histnorm parameter --- plotly/tools.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/plotly/tools.py b/plotly/tools.py index 102676ce65b..877d57fffd8 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -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 density', show_hist=True, show_curve=True, show_rug=True): """ @@ -4144,23 +4144,23 @@ def create_distplot(hist_data, group_labels, bin_size = [bin_size]*len(hist_data) hist = _Distplot( - hist_data, group_labels, bin_size, + hist_data, histnorm, group_labels, bin_size, curve_type, colors, rug_text, show_hist, show_curve).make_hist() if curve_type == 'normal': curve = _Distplot( - hist_data, group_labels, bin_size, + hist_data, histnorm, group_labels, bin_size, curve_type, colors, rug_text, show_hist, show_curve).make_normal() else: curve = _Distplot( - hist_data, group_labels, bin_size, + hist_data, histnorm, group_labels, bin_size, curve_type, colors, rug_text, show_hist, show_curve).make_kde() rug = _Distplot( - hist_data, group_labels, bin_size, + hist_data, histnorm, group_labels, bin_size, curve_type, colors, rug_text, show_hist, show_curve).make_rug() @@ -5036,10 +5036,11 @@ class _Distplot(FigureFactory): """ Refer to TraceFactory.create_distplot() for docstring """ - def __init__(self, hist_data, group_labels, + def __init__(self, hist_data, histnorm, group_labels, bin_size, curve_type, colors, rug_text, show_hist, show_curve): self.hist_data = hist_data + self.histnorm = histnorm self.group_labels = group_labels self.bin_size = bin_size self.show_hist = show_hist @@ -5081,7 +5082,7 @@ def make_hist(self): x=self.hist_data[index], xaxis='x1', yaxis='y1', - histnorm='probability density', + histnorm=self.histnorm, name=self.group_labels[index], legendgroup=self.group_labels[index], marker=dict(color=self.colors[index]), @@ -5108,7 +5109,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': + self.curve_y[index] *= self.bin_size[index] for index in range(self.trace_number): curve[index] = dict(type='scatter', @@ -5143,7 +5146,9 @@ def make_normal(self): / 500 for x in range(500)] self.curve_y[index] = scipy.stats.norm.pdf( self.curve_x[index], loc=mean[index], scale=sd[index]) - # self.curve_y[index] *= self.bin_size[index] + + if self.histnorm == 'probability': + self.curve_y[index] *= self.bin_size[index] for index in range(self.trace_number): curve[index] = dict(type='scatter', @@ -5621,4 +5626,3 @@ def make_table_annotations(self): font=dict(color=font_color), showarrow=False)) return annotations - From e4e53ef4f92d8f3c93332926401f0180f9998944 Mon Sep 17 00:00:00 2001 From: yankev Date: Wed, 25 May 2016 17:19:43 -0400 Subject: [PATCH 5/9] added tests to cover both options of histnorm --- .../test_optional/test_figure_factory.py | 182 ++++++++++++++++-- plotly/tools.py | 2 +- 2 files changed, 171 insertions(+), 13 deletions(-) diff --git a/plotly/tests/test_optional/test_figure_factory.py b/plotly/tests/test_optional/test_figure_factory.py index efce6946513..bc88645410c 100644 --- a/plotly/tests/test_optional/test_figure_factory.py +++ b/plotly/tests/test_optional/test_figure_factory.py @@ -44,13 +44,14 @@ def test_unequal_data_label_length(self): self.assertRaises(PlotlyError, tls.FigureFactory.create_distplot, **kwargs) - def test_simple_distplot(self): + def test_simple_distplot_prob_density(self): # we should be able to create a single distplot with a simple dataset # and default kwargs dp = tls.FigureFactory.create_distplot(hist_data=[[1, 2, 2, 3]], - group_labels=['distplot']) + group_labels=['distplot'], + histnorm='probability density') expected_dp_layout = {'barmode': 'overlay', 'hovermode': 'closest', 'legend': {'traceorder': 'reversed'}, @@ -90,7 +91,53 @@ def test_simple_distplot(self): 'yaxis': 'y2'} self.assertEqual(dp['data'][2], expected_dp_data_rug) - def test_distplot_more_args(self): + def test_simple_distplot_prob(self): + + # we should be able to create a single distplot with a simple dataset + # and default kwargs + + dp = tls.FigureFactory.create_distplot(hist_data=[[1, 2, 2, 3]], + group_labels=['distplot'], histnorm='probability') + expected_dp_layout = {'barmode': 'overlay', + 'hovermode': 'closest', + 'legend': {'traceorder': 'reversed'}, + 'xaxis1': {'anchor': 'y2', 'domain': [0.0, 1.0], 'zeroline': False}, + 'yaxis1': {'anchor': 'free', 'domain': [0.35, 1], 'position': 0.0}, + 'yaxis2': {'anchor': 'x1', + 'domain': [0, 0.25], + 'dtick': 1, + 'showticklabels': False}} + self.assertEqual(dp['layout'], expected_dp_layout) + + expected_dp_data_hist = {'autobinx': False, + 'histnorm': 'probability', + 'legendgroup': 'distplot', + 'marker': {'color': 'rgb(31, 119, 180)'}, + 'name': 'distplot', + 'opacity': 0.7, + 'type': 'histogram', + 'x': [1, 2, 2, 3], + 'xaxis': 'x1', + 'xbins': {'end': 3.0, 'size': 1.0, 'start': 1.0}, + 'yaxis': 'y1'} + self.assertEqual(dp['data'][0], expected_dp_data_hist) + + expected_dp_data_rug = {'legendgroup': 'distplot', + 'marker': {'color': 'rgb(31, 119, 180)', + 'symbol': 'line-ns-open'}, + 'mode': 'markers', + 'name': 'distplot', + 'showlegend': False, + 'text': None, + 'type': 'scatter', + 'x': [1, 2, 2, 3], + 'xaxis': 'x1', + 'y': ['distplot', 'distplot', + 'distplot', 'distplot'], + 'yaxis': 'y2'} + self.assertEqual(dp['data'][2], expected_dp_data_rug) + + def test_distplot_more_args_prob_dens(self): # we should be able to create a distplot with 2 datasets no # rugplot, defined bin_size, and added title @@ -106,6 +153,7 @@ def test_distplot_more_args(self): group_labels = ['2012', '2013'] dp = tls.FigureFactory.create_distplot(hist_data, group_labels, + histnorm='probability density', show_rug=False, bin_size=.2) dp['layout'].update(title='Dist Plot') @@ -151,7 +199,115 @@ def test_distplot_more_args(self): 'yaxis': 'y1'} self.assertEqual(dp['data'][1], expected_dp_data_hist_2) - def test_distplot_binsize_array(self): + def test_distplot_more_args_prob(self): + + # we should be able to create a distplot with 2 datasets no + # rugplot, defined bin_size, and added title + + hist1_x = [0.8, 1.2, 0.2, 0.6, 1.6, + -0.9, -0.07, 1.95, 0.9, -0.2, + -0.5, 0.3, 0.4, -0.37, 0.6] + hist2_x = [0.8, 1.5, 1.5, 0.6, 0.59, + 1.0, 0.8, 1.7, 0.5, 0.8, + -0.3, 1.2, 0.56, 0.3, 2.2] + + hist_data = [hist1_x] + [hist2_x] + group_labels = ['2012', '2013'] + + dp = tls.FigureFactory.create_distplot(hist_data, group_labels, + show_rug=False, bin_size=.2) + dp['layout'].update(title='Dist Plot') + + expected_dp_layout = {'barmode': 'overlay', + 'hovermode': 'closest', + 'legend': {'traceorder': 'reversed'}, + 'title': 'Dist Plot', + 'xaxis1': {'anchor': 'y2', 'domain': [0.0, 1.0], + 'zeroline': False}, + 'yaxis1': {'anchor': 'free', 'domain': [0.0, 1], + 'position': 0.0}} + self.assertEqual(dp['layout'], expected_dp_layout) + + expected_dp_data_hist_1 = {'autobinx': False, + 'histnorm': 'probability', + 'legendgroup': '2012', + 'marker': {'color': 'rgb(31, 119, 180)'}, + 'name': '2012', + 'opacity': 0.7, + 'type': 'histogram', + 'x': [0.8, 1.2, 0.2, 0.6, 1.6, -0.9, -0.07, + 1.95, 0.9, -0.2, -0.5, 0.3, 0.4, + -0.37, 0.6], + 'xaxis': 'x1', + 'xbins': {'end': 1.95, 'size': 0.2, + 'start': -0.9}, + 'yaxis': 'y1'} + self.assertEqual(dp['data'][0], expected_dp_data_hist_1) + + expected_dp_data_hist_2 = {'autobinx': False, + 'histnorm': 'probability', + 'legendgroup': '2013', + 'marker': {'color': 'rgb(255, 127, 14)'}, + 'name': '2013', + 'opacity': 0.7, + 'type': 'histogram', + 'x': [0.8, 1.5, 1.5, 0.6, 0.59, 1.0, 0.8, + 1.7, 0.5, 0.8, -0.3, 1.2, 0.56, 0.3, + 2.2], + 'xaxis': 'x1', + 'xbins': {'end': 2.2, 'size': 0.2, + 'start': -0.3}, + 'yaxis': 'y1'} + self.assertEqual(dp['data'][1], expected_dp_data_hist_2) + + def test_distplot_binsize_array_prob(self): + hist1_x = [0.8, 1.2, 0.2, 0.6, 1.6, -0.9, -0.07, 1.95, 0.9, -0.2, + -0.5, 0.3, 0.4, -0.37, 0.6] + hist2_x = [0.8, 1.5, 1.5, 0.6, 0.59, 1.0, 0.8, 1.7, 0.5, 0.8, -0.3, + 1.2, 0.56, 0.3, 2.2] + + hist_data = [hist1_x, hist2_x] + group_labels = ['2012', '2013'] + + dp = tls.FigureFactory.create_distplot(hist_data, group_labels, + show_rug=False, + bin_size=[.2, .2]) + + expected_dp_data_hist_1 = {'autobinx': False, + 'histnorm': 'probability density', + 'legendgroup': '2012', + 'marker': + {'color': 'rgb(31, 119, 180)'}, + 'name': '2012', + 'opacity': 0.7, + 'type': 'histogram', + 'x': [0.8, 1.2, 0.2, 0.6, 1.6, -0.9, + -0.07, 1.95, 0.9, -0.2, -0.5, 0.3, + 0.4, -0.37, 0.6], + 'xaxis': 'x1', + 'xbins': {'end': 1.95, 'size': 0.2, + 'start': -0.9}, + 'yaxis': 'y1'} + self.assertEqual(dp['data'][0], expected_dp_data_hist_1) + + expected_dp_data_hist_2 = {'autobinx': False, + 'histnorm': 'probability density', + 'legendgroup': '2013', + 'marker': + {'color': 'rgb(255, 127, 14)'}, + 'name': '2013', + 'opacity': 0.7, + 'type': 'histogram', + 'x': [0.8, 1.5, 1.5, 0.6, 0.59, 1.0, + 0.8, 1.7, 0.5, 0.8, -0.3, 1.2, + 0.56, 0.3, 2.2], + 'xaxis': 'x1', + 'xbins': {'end': 2.2, 'size': 0.2, + 'start': -0.3}, + 'yaxis': 'y1'} + self.assertEqual(dp['data'][1], expected_dp_data_hist_2) + + def test_distplot_binsize_array_prob_density(self): hist1_x = [0.8, 1.2, 0.2, 0.6, 1.6, -0.9, -0.07, 1.95, 0.9, -0.2, -0.5, 0.3, 0.4, -0.37, 0.6] hist2_x = [0.8, 1.5, 1.5, 0.6, 0.59, 1.0, 0.8, 1.7, 0.5, 0.8, -0.3, @@ -167,13 +323,14 @@ def test_distplot_binsize_array(self): expected_dp_data_hist_1 = {'autobinx': False, 'histnorm': 'probability density', 'legendgroup': '2012', - 'marker': {'color': 'rgb(31, 119, 180)'}, + 'marker': + {'color': 'rgb(31, 119, 180)'}, 'name': '2012', 'opacity': 0.7, 'type': 'histogram', - 'x': [0.8, 1.2, 0.2, 0.6, 1.6, -0.9, -0.07, - 1.95, 0.9, -0.2, -0.5, 0.3, 0.4, - -0.37, 0.6], + 'x': [0.8, 1.2, 0.2, 0.6, 1.6, -0.9, + -0.07, 1.95, 0.9, -0.2, -0.5, 0.3, + 0.4, -0.37, 0.6], 'xaxis': 'x1', 'xbins': {'end': 1.95, 'size': 0.2, 'start': -0.9}, @@ -183,13 +340,14 @@ def test_distplot_binsize_array(self): expected_dp_data_hist_2 = {'autobinx': False, 'histnorm': 'probability density', 'legendgroup': '2013', - 'marker': {'color': 'rgb(255, 127, 14)'}, + 'marker': + {'color': 'rgb(255, 127, 14)'}, 'name': '2013', 'opacity': 0.7, 'type': 'histogram', - 'x': [0.8, 1.5, 1.5, 0.6, 0.59, 1.0, 0.8, - 1.7, 0.5, 0.8, -0.3, 1.2, 0.56, 0.3, - 2.2], + 'x': [0.8, 1.5, 1.5, 0.6, 0.59, 1.0, + 0.8, 1.7, 0.5, 0.8, -0.3, 1.2, + 0.56, 0.3, 2.2], 'xaxis': 'x1', 'xbins': {'end': 2.2, 'size': 0.2, 'start': -0.3}, diff --git a/plotly/tools.py b/plotly/tools.py index 877d57fffd8..607d2443f82 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -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=[], histnorm='probability density', + colors=[], rug_text=[], histnorm='probability', show_hist=True, show_curve=True, show_rug=True): """ From 342fa5476f2b95482ce0fd7f83b88717fa85d17f Mon Sep 17 00:00:00 2001 From: yankev Date: Wed, 25 May 2016 19:21:59 -0400 Subject: [PATCH 6/9] edited docstring --- plotly/tools.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plotly/tools.py b/plotly/tools.py index 607d2443f82..9fc3b2f6472 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -4036,6 +4036,8 @@ def create_distplot(hist_data, group_labels, :param (list[float]|float) bin_size: Size of histogram bins. Default = 1. :param (str) curve_type: 'kde' or 'normal'. Default = 'kde' + :param (str) histnorm: 'probability density' or 'probability' + Default = 'probability' :param (bool) show_hist: Add histogram to distplot? Default = True :param (bool) show_curve: Add curve to distplot? Default = True :param (bool) show_rug: Add rug to distplot? Default = True From 4570e59b6e2e706fcc4ebbf8efa709f0d4fb9b3f Mon Sep 17 00:00:00 2001 From: yankev Date: Thu, 26 May 2016 13:33:34 -0400 Subject: [PATCH 7/9] changed default to probability density --- plotly/tests/test_optional/test_figure_factory.py | 3 +++ plotly/tools.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plotly/tests/test_optional/test_figure_factory.py b/plotly/tests/test_optional/test_figure_factory.py index bc88645410c..03e9cbc6159 100644 --- a/plotly/tests/test_optional/test_figure_factory.py +++ b/plotly/tests/test_optional/test_figure_factory.py @@ -215,6 +215,7 @@ def test_distplot_more_args_prob(self): group_labels = ['2012', '2013'] dp = tls.FigureFactory.create_distplot(hist_data, group_labels, + histnorm='probability', show_rug=False, bin_size=.2) dp['layout'].update(title='Dist Plot') @@ -270,6 +271,7 @@ def test_distplot_binsize_array_prob(self): group_labels = ['2012', '2013'] dp = tls.FigureFactory.create_distplot(hist_data, group_labels, + histnorm='probability', show_rug=False, bin_size=[.2, .2]) @@ -317,6 +319,7 @@ def test_distplot_binsize_array_prob_density(self): group_labels = ['2012', '2013'] dp = tls.FigureFactory.create_distplot(hist_data, group_labels, + histnorm='probability', show_rug=False, bin_size=[.2, .2]) diff --git a/plotly/tools.py b/plotly/tools.py index 9fc3b2f6472..e3f26704134 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -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=[], histnorm='probability', + colors=[], rug_text=[], histnorm='probability density', show_hist=True, show_curve=True, show_rug=True): """ From 141a789ebeccbf17eb79f4694142f37ce26cea74 Mon Sep 17 00:00:00 2001 From: yankev Date: Thu, 26 May 2016 14:28:05 -0400 Subject: [PATCH 8/9] changed default value in docstring --- plotly/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plotly/tools.py b/plotly/tools.py index e3f26704134..6d461002cbb 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -4037,7 +4037,7 @@ def create_distplot(hist_data, group_labels, Default = 1. :param (str) curve_type: 'kde' or 'normal'. Default = 'kde' :param (str) histnorm: 'probability density' or 'probability' - Default = 'probability' + Default = 'probability density' :param (bool) show_hist: Add histogram to distplot? Default = True :param (bool) show_curve: Add curve to distplot? Default = True :param (bool) show_rug: Add rug to distplot? Default = True From bda25316e6cec48c71ef044eac61aa38bb04eae1 Mon Sep 17 00:00:00 2001 From: yankev Date: Thu, 26 May 2016 18:10:07 -0400 Subject: [PATCH 9/9] put histnorm values into variables --- plotly/tools.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plotly/tools.py b/plotly/tools.py index 6d461002cbb..b02daa4d6ea 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -28,6 +28,9 @@ 'rgb(227, 119, 194)', 'rgb(127, 127, 127)', 'rgb(188, 189, 34)', 'rgb(23, 190, 207)'] +DEFAULT_HISTNORM = 'probability density' +ALTERNATIVE_HISTNORM = 'probability' + # Warning format def warning_on_one_line(message, category, filename, lineno, @@ -4019,7 +4022,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=[], histnorm='probability density', + colors=[], rug_text=[], histnorm=DEFAULT_HISTNORM, show_hist=True, show_curve=True, show_rug=True): """ @@ -5112,7 +5115,7 @@ def make_kde(self): (self.hist_data[index]) (self.curve_x[index])) - if self.histnorm == 'probability': + if self.histnorm == ALTERNATIVE_HISTNORM: self.curve_y[index] *= self.bin_size[index] for index in range(self.trace_number): @@ -5149,7 +5152,7 @@ def make_normal(self): self.curve_y[index] = scipy.stats.norm.pdf( self.curve_x[index], loc=mean[index], scale=sd[index]) - if self.histnorm == 'probability': + if self.histnorm == ALTERNATIVE_HISTNORM: self.curve_y[index] *= self.bin_size[index] for index in range(self.trace_number):