awacke1 commited on
Commit
89b91ac
Β·
1 Parent(s): 1d223de

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -0
app.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import plotly.graph_objs as go
3
+ import plotly.express as px
4
+ from graphviz import Digraph
5
+
6
+ st.title('Dog 🐢, Cat 🐱, and Graph πŸ“Š Adventures Visualizations')
7
+
8
+ # Sankey Diagram
9
+ st.header('Sankey Diagram')
10
+ sankey_data = dict(
11
+ type='sankey',
12
+ node=dict(
13
+ pad=15,
14
+ thickness=20,
15
+ line=dict(color='black', width=0.5),
16
+ label=['A', 'B', 'C', 'D', 'E', 'F'],
17
+ ),
18
+ link=dict(
19
+ source=[0, 1, 0, 2, 3, 3],
20
+ target=[2, 3, 3, 4, 4, 5],
21
+ value=[8, 4, 2, 8, 4, 2],
22
+ )
23
+ )
24
+
25
+ sankey_fig = go.Figure(sankey_data)
26
+ st.plotly_chart(sankey_fig)
27
+
28
+ # Plotly 3D Scatterplot
29
+ st.header('3D Scatterplot')
30
+ scatter_data = px.scatter_3d(x=[1, 2, 3, 4], y=[2, 3, 4, 5], z=[3, 4, 5, 6], color=['A', 'B', 'C', 'D'])
31
+
32
+ st.plotly_chart(scatter_data)
33
+
34
+ # Plotly Sunburst Chart
35
+ st.header('Sunburst Chart')
36
+ sunburst_data = px.sunburst(
37
+ data_frame={'id': ['A', 'B', 'C', 'D', 'E', 'F'], 'parent': ['', 'A', 'A', 'B', 'B', 'C'], 'value': [1, 2, 3, 4, 5, 6]},
38
+ names='id',
39
+ parents='parent',
40
+ values='value',
41
+ )
42
+
43
+ st.plotly_chart(sunburst_data)
44
+
45
+ # Graphviz
46
+ st.header('Graphviz Diagram')
47
+ dot = Digraph()
48
+ dot.node('A', 'Dog 🐢')
49
+ dot.node('B', 'Cat 🐱')
50
+ dot.node('C', 'Graph πŸ“Š')
51
+ dot.edges(['AB', 'AC', 'BC'])
52
+
53
+ st.graphviz_chart(dot)
54
+
55
+ # Heatmap
56
+ st.header('Heatmap')
57
+ heatmap_data = px.imshow([[1, 20, 30], [20, 1, 60], [30, 60, 1]], color_continuous_scale='RdBu_r')
58
+
59
+ st.plotly_chart(heatmap_data)