File size: 1,455 Bytes
89b91ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import streamlit as st
import plotly.graph_objs as go
import plotly.express as px
from graphviz import Digraph

st.title('Dog 🐢, Cat 🐱, and Graph πŸ“Š Adventures Visualizations')

# Sankey Diagram
st.header('Sankey Diagram')
sankey_data = dict(
    type='sankey',
    node=dict(
        pad=15,
        thickness=20,
        line=dict(color='black', width=0.5),
        label=['A', 'B', 'C', 'D', 'E', 'F'],
    ),
    link=dict(
        source=[0, 1, 0, 2, 3, 3],
        target=[2, 3, 3, 4, 4, 5],
        value=[8, 4, 2, 8, 4, 2],
    )
)

sankey_fig = go.Figure(sankey_data)
st.plotly_chart(sankey_fig)

# Plotly 3D Scatterplot
st.header('3D Scatterplot')
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'])

st.plotly_chart(scatter_data)

# Plotly Sunburst Chart
st.header('Sunburst Chart')
sunburst_data = px.sunburst(
    data_frame={'id': ['A', 'B', 'C', 'D', 'E', 'F'], 'parent': ['', 'A', 'A', 'B', 'B', 'C'], 'value': [1, 2, 3, 4, 5, 6]},
    names='id',
    parents='parent',
    values='value',
)

st.plotly_chart(sunburst_data)

# Graphviz
st.header('Graphviz Diagram')
dot = Digraph()
dot.node('A', 'Dog 🐢')
dot.node('B', 'Cat 🐱')
dot.node('C', 'Graph πŸ“Š')
dot.edges(['AB', 'AC', 'BC'])

st.graphviz_chart(dot)

# Heatmap
st.header('Heatmap')
heatmap_data = px.imshow([[1, 20, 30], [20, 1, 60], [30, 60, 1]], color_continuous_scale='RdBu_r')

st.plotly_chart(heatmap_data)