title: Plotly: How to show both a normal distribution and a kernel density estimation in a histogram?
body: <p>For a plotly figure factory distribution plot, the default  distribution is <code>kde</code> (<a href="https://scikit-learn.org/stable/modules/density.html#kernel-density-estimation" rel="nofollow noreferrer">kernel density estimation</a>):</p>
  <p><a href="https://i.stack.imgur.com/DDReE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DDReE.png" alt="enter image description here" /></a></p>
  <p>You can override the default by setting <code>curve = 'normal'</code> to get:</p>
  <p><a href="https://i.stack.imgur.com/u7Ejv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/u7Ejv.png" alt="enter image description here" /></a></p>
  <p>But how can you show both kde and the normal curve in the same plot? Assigning a list like <code>curve_type = ['kde', 'normal']</code> will not work.</p>
  <h3>Complete code:</h3>
  <pre><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()
  </code></pre>