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

Skip to content

Commit bda2531

Browse files
committed
put histnorm values into variables
1 parent 141a789 commit bda2531

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

plotly/tools.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
'rgb(227, 119, 194)', 'rgb(127, 127, 127)',
2929
'rgb(188, 189, 34)', 'rgb(23, 190, 207)']
3030

31+
DEFAULT_HISTNORM = 'probability density'
32+
ALTERNATIVE_HISTNORM = 'probability'
33+
3134

3235
# Warning format
3336
def warning_on_one_line(message, category, filename, lineno,
@@ -4019,7 +4022,7 @@ def create_candlestick(open, high, low, close,
40194022
@staticmethod
40204023
def create_distplot(hist_data, group_labels,
40214024
bin_size=1., curve_type='kde',
4022-
colors=[], rug_text=[], histnorm='probability density',
4025+
colors=[], rug_text=[], histnorm=DEFAULT_HISTNORM,
40234026
show_hist=True, show_curve=True,
40244027
show_rug=True):
40254028
"""
@@ -5112,7 +5115,7 @@ def make_kde(self):
51125115
(self.hist_data[index])
51135116
(self.curve_x[index]))
51145117

5115-
if self.histnorm == 'probability':
5118+
if self.histnorm == ALTERNATIVE_HISTNORM:
51165119
self.curve_y[index] *= self.bin_size[index]
51175120

51185121
for index in range(self.trace_number):
@@ -5149,7 +5152,7 @@ def make_normal(self):
51495152
self.curve_y[index] = scipy.stats.norm.pdf(
51505153
self.curve_x[index], loc=mean[index], scale=sd[index])
51515154

5152-
if self.histnorm == 'probability':
5155+
if self.histnorm == ALTERNATIVE_HISTNORM:
51535156
self.curve_y[index] *= self.bin_size[index]
51545157

51555158
for index in range(self.trace_number):

0 commit comments

Comments
 (0)