streamlit / pages /old /_plotly_graph_objs.py
f64
1
74fa2db
import streamlit as st, pandas as pd, numpy as np
import my_static_tools as mst
st.html(mst.STYLE_CORRECTION)
import plotly.figure_factory as ff
import plotly.graph_objs as go
st.sidebar.markdown("# ПРИМЕР : интерактивные графики на Plotly plotly.graph_objs 📊")
n = 80 # 200
# Add histogram data
x1 = np.random.randn(n) # - 2
x2 = np.random.randn(n)
x3 = np.random.randn(n) # + 2
x4 = np.random.randn(n)
# https://discuss.streamlit.io/t/update-3d-scatter-plot-without-resetting-view/20686
my_uirevision = "qwerty"
figure = {
"data": [go.Scatter3d(z=x1, y=x2, x=x3, mode='markers',
marker=dict(color=x4, size=4, opacity=0.5) # , colorscale='Viridis'
)],
"layout": go.Layout(margin=dict(l=0, r=0, b=0, t=0), height=750, uirevision=my_uirevision)
}
st.plotly_chart(figure)
# 1
#hist_data = [x1, x2, x3]
#group_labels = ['Group 1', 'Group 2', 'Group 3']
#fig = ff.create_distplot(hist_data, group_labels, bin_size=[.1, .25, .5])
#st.plotly_chart(fig, use_container_width=True)