Makes the kernel density estimation(s) for create_distplot(). This is called when curve_type = 'kde' in create_distplot(). :rtype (list) curve: list of kde representations
(self)
| 340 | return hist |
| 341 | |
| 342 | def make_kde(self): |
| 343 | """ |
| 344 | Makes the kernel density estimation(s) for create_distplot(). |
| 345 | |
| 346 | This is called when curve_type = 'kde' in create_distplot(). |
| 347 | |
| 348 | :rtype (list) curve: list of kde representations |
| 349 | """ |
| 350 | curve = [None] * self.trace_number |
| 351 | for index in range(self.trace_number): |
| 352 | self.curve_x[index] = [ |
| 353 | self.start[index] + x * (self.end[index] - self.start[index]) / 500 |
| 354 | for x in range(500) |
| 355 | ] |
| 356 | self.curve_y[index] = scipy_stats.gaussian_kde(self.hist_data[index])( |
| 357 | self.curve_x[index] |
| 358 | ) |
| 359 | |
| 360 | if self.histnorm == ALTERNATIVE_HISTNORM: |
| 361 | self.curve_y[index] *= self.bin_size[index] |
| 362 | |
| 363 | for index in range(self.trace_number): |
| 364 | curve[index] = dict( |
| 365 | type="scatter", |
| 366 | x=self.curve_x[index], |
| 367 | y=self.curve_y[index], |
| 368 | xaxis="x1", |
| 369 | yaxis="y1", |
| 370 | mode="lines", |
| 371 | name=self.group_labels[index], |
| 372 | legendgroup=self.group_labels[index], |
| 373 | showlegend=False if self.show_hist else True, |
| 374 | marker=dict(color=self.colors[index % len(self.colors)]), |
| 375 | ) |
| 376 | return curve |
| 377 | |
| 378 | def make_normal(self): |
| 379 | """ |