awacke1's picture
Create app.py
89b91ac
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)