streamlit-component-gallery / pages /charts.plotly_chart.py
whitphx's picture
whitphx HF staff
Copy sample files from streamlit/docs/python/api-examples-source/* (4e54057)
9c1ffe9
import numpy as np
import plotly.figure_factory as ff
import streamlit as st
@st.cache_data
def load_data():
# Add histogram data
x1 = np.random.randn(200) - 2
x2 = np.random.randn(200)
x3 = np.random.randn(200) + 2
# Group data together
hist_data = [x1, x2, x3]
return hist_data
hist_data = load_data()
group_labels = ["Group 1", "Group 2", "Group 3"]
# Create distplot with custom bin_size
fig = ff.create_distplot(hist_data, group_labels, bin_size=[0.1, 0.25, 0.5])
# Plot!
st.plotly_chart(fig)