Distplot with PDF

test1
I want this kind of plot with Plotly. I’m using Plotly offline with Cufflinks.

Hi @Hackyroot,

Check out the distplot figure factory examples at https://plot.ly/python/distplot/. Here’s one that’s pretty close to what you have there.

import plotly.figure_factory as ff
from plotly.offline import iplot, init_notebook_mode
init_notebook_mode()

import numpy as np

# Add histogram data
x1 = np.random.randn(200)-2  
x2 = np.random.randn(200)  

# Group data together
hist_data = [x1, x2]

group_labels = ['Group 1', 'Group 2']

# Create distplot with custom bin_size
fig = ff.create_distplot(hist_data, group_labels, bin_size=.2, show_rug=False)

# Set titles
fig.layout.title = 'Distplot Title'

# Plot!
iplot(fig)

Hope that helps!
-Jon

Thank you very much @jmmease
Your other answer also helped me to get the output I wanted.
Keep contributing :+1:

1 Like