For a plotly figure factory distribution plot, the default distribution is kde
(kernel density estimation):
You can override the default by setting curve = 'normal'
to get:
But how can you show both kde and the normal curve in the same plot? Assigning a list like curve_type = ['kde', 'normal']
will not work.
Complete code:
import plotly.figure_factory as ff
import plotly.graph_objects as go
import plotly.express as px
import numpy as np
np.random.seed(2)
x = np.random.randn(1000)
hist_data = [x]
group_labels = ['distplot'] # name of the dataset
mean = np.mean(x)
stdev_pluss = np.std(x)
stdev_minus = np.std(x)*-1
fig = ff.create_distplot(hist_data, group_labels, curve_type='kde')
fig.update_layout(template = 'plotly_dark')
fig.show()