f64
commited on
Commit
·
7e8181a
1
Parent(s):
aa6b034
- pages/6_Plotly.py +15 -10
pages/6_Plotly.py
CHANGED
|
@@ -4,19 +4,24 @@ st.sidebar.markdown("# интерактивные графики на Plotly
|
|
| 4 |
st.markdown("<style> header[data-testid='stHeader'] { display:none }", unsafe_allow_html=True)
|
| 5 |
|
| 6 |
import plotly.figure_factory as ff
|
|
|
|
| 7 |
|
|
|
|
| 8 |
# Add histogram data
|
| 9 |
-
x1 = np.random.randn(
|
| 10 |
-
x2 = np.random.randn(
|
| 11 |
-
x3 = np.random.randn(
|
| 12 |
|
| 13 |
-
# Group data together
|
| 14 |
-
hist_data = [x1, x2, x3]
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
-
fig = ff.create_distplot(hist_data, group_labels, bin_size=[.1, .25, .5])
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
st.markdown("<style> header[data-testid='stHeader'] { display:none }", unsafe_allow_html=True)
|
| 5 |
|
| 6 |
import plotly.figure_factory as ff
|
| 7 |
+
import plotly.graph_objs as go
|
| 8 |
|
| 9 |
+
n = 20 # 200
|
| 10 |
# Add histogram data
|
| 11 |
+
x1 = np.random.randn(n) - 2
|
| 12 |
+
x2 = np.random.randn(n)
|
| 13 |
+
x3 = np.random.randn(n) + 2
|
| 14 |
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
figure = {
|
| 17 |
+
"data": [go.Surface(z=x1, y=x2, x=x3)],
|
| 18 |
+
"layout": go.Layout(height=700, margin=dict(l=0, r=0, b=0, t=30), uirevision='foo')
|
| 19 |
+
}
|
| 20 |
|
| 21 |
+
st.plotly_chart(figure)
|
|
|
|
| 22 |
|
| 23 |
+
# 1
|
| 24 |
+
#hist_data = [x1, x2, x3]
|
| 25 |
+
#group_labels = ['Group 1', 'Group 2', 'Group 3']
|
| 26 |
+
#fig = ff.create_distplot(hist_data, group_labels, bin_size=[.1, .25, .5])
|
| 27 |
+
#st.plotly_chart(fig, use_container_width=True)
|