MCPcopy Index your code
hub / github.com/plotly/plotly.py / make_normal

Method make_normal

plotly/figure_factory/_distplot.py:378–416  ·  view source on GitHub ↗

Makes the normal curve(s) for create_distplot(). This is called when curve_type = 'normal' in create_distplot(). :rtype (list) curve: list of normal curve representations

(self)

Source from the content-addressed store, hash-verified

376 return curve
377
378 def make_normal(self):
379 """
380 Makes the normal curve(s) for create_distplot().
381
382 This is called when curve_type = 'normal' in create_distplot().
383
384 :rtype (list) curve: list of normal curve representations
385 """
386 curve = [None] * self.trace_number
387 mean = [None] * self.trace_number
388 sd = [None] * self.trace_number
389
390 for index in range(self.trace_number):
391 mean[index], sd[index] = scipy_stats.norm.fit(self.hist_data[index])
392 self.curve_x[index] = [
393 self.start[index] + x * (self.end[index] - self.start[index]) / 500
394 for x in range(500)
395 ]
396 self.curve_y[index] = scipy_stats.norm.pdf(
397 self.curve_x[index], loc=mean[index], scale=sd[index]
398 )
399
400 if self.histnorm == ALTERNATIVE_HISTNORM:
401 self.curve_y[index] *= self.bin_size[index]
402
403 for index in range(self.trace_number):
404 curve[index] = dict(
405 type="scatter",
406 x=self.curve_x[index],
407 y=self.curve_y[index],
408 xaxis="x1",
409 yaxis="y1",
410 mode="lines",
411 name=self.group_labels[index],
412 legendgroup=self.group_labels[index],
413 showlegend=False if self.show_hist else True,
414 marker=dict(color=self.colors[index % len(self.colors)]),
415 )
416 return curve
417
418 def make_rug(self):
419 """

Callers 1

create_distplotFunction · 0.80

Calls 1

fitMethod · 0.45

Tested by

no test coverage detected