Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,6 @@ import plotly.graph_objects as go
|
|
7 |
st.set_page_config(page_title="Plotly Graphing Libraries",layout='wide')
|
8 |
|
9 |
st.markdown("# Treemaps: https://plotly.com/python/treemaps/")
|
10 |
-
|
11 |
-
|
12 |
df = px.data.gapminder().query("year == 2007")
|
13 |
fig = px.treemap(df, path=[px.Constant("world"), 'continent', 'country'], values='pop',
|
14 |
color='lifeExp', hover_data=['iso_alpha'],
|
@@ -19,6 +17,21 @@ fig.update_layout(margin = dict(t=50, l=25, r=25, b=25))
|
|
19 |
st.plotly_chart(fig, use_container_width=True)
|
20 |
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
df = px.data.tips()
|
23 |
fig = px.treemap(df, path=[px.Constant("all"), 'sex', 'day', 'time'],
|
24 |
values='total_bill', color='time',
|
|
|
7 |
st.set_page_config(page_title="Plotly Graphing Libraries",layout='wide')
|
8 |
|
9 |
st.markdown("# Treemaps: https://plotly.com/python/treemaps/")
|
|
|
|
|
10 |
df = px.data.gapminder().query("year == 2007")
|
11 |
fig = px.treemap(df, path=[px.Constant("world"), 'continent', 'country'], values='pop',
|
12 |
color='lifeExp', hover_data=['iso_alpha'],
|
|
|
17 |
st.plotly_chart(fig, use_container_width=True)
|
18 |
|
19 |
|
20 |
+
st.markdown("# Sunburst: https://plotly.com/python/sunburst-charts/")
|
21 |
+
data = dict(
|
22 |
+
character=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"],
|
23 |
+
parent=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ],
|
24 |
+
value=[10, 14, 12, 10, 2, 6, 6, 4, 4])
|
25 |
+
fig = px.sunburst(
|
26 |
+
data,
|
27 |
+
names='character',
|
28 |
+
parents='parent',
|
29 |
+
values='value',
|
30 |
+
)
|
31 |
+
#fig.show()
|
32 |
+
st.plotly_chart(fig, use_container_width=True)
|
33 |
+
|
34 |
+
|
35 |
df = px.data.tips()
|
36 |
fig = px.treemap(df, path=[px.Constant("all"), 'sex', 'day', 'time'],
|
37 |
values='total_bill', color='time',
|