keneonyeachonam's picture
Upload 3 files
8bb9bd4
raw history blame
No virus
935 Bytes
import streamlit as st
import plotly.graph_objects as go
import plotly.graph_objects as go
def create_sunburst_plot(labels, parents, values, ids, text):
fig = go.Figure(go.Sunburst(
labels=labels,
parents=parents,
values=values,
ids=ids,
text=text,
hoverinfo="label+value",
branchvalues="total",
))
fig.update_layout(margin=dict(t=0, l=0, r=0, b=0))
return fig
# Replace these lists with your own data
labels = ["Root", "Hip Surgery", "Knee Surgery", "CPT1", "CPT2", "CPT3", "CPT4"]
parents = ["", "Root", "Root", "Hip Surgery", "Hip Surgery", "Knee Surgery", "Knee Surgery"]
values = [None, 30, 40, 20, 10, 25, 15]
ids = ["Root", "Hip Surgery", "Knee Surgery", "CPT1", "CPT2", "CPT3", "CPT4"]
text = ["Root", "Hip Surgery", "Knee Surgery", "CPT1", "CPT2", "CPT3", "CPT4"]
fig = create_sunburst_plot(labels, parents, values, ids, text)
st.plotly_chart(fig)