Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +7 -2
src/streamlit_app.py
CHANGED
|
@@ -47,14 +47,19 @@ if submitted:
|
|
| 47 |
"Flights": flights * EMISSION_FACTORS["Flights"]
|
| 48 |
}
|
| 49 |
|
| 50 |
-
# Pie chart
|
| 51 |
st.markdown("### 🧾 Activity-wise Contribution to Your Footprint")
|
|
|
|
|
|
|
| 52 |
fig = px.pie(
|
| 53 |
names=yearly_values.keys(),
|
| 54 |
values=yearly_values.values(),
|
| 55 |
title="Your Carbon Footprint Breakdown",
|
| 56 |
-
color_discrete_sequence=
|
|
|
|
| 57 |
)
|
|
|
|
|
|
|
| 58 |
st.plotly_chart(fig, use_container_width=True)
|
| 59 |
|
| 60 |
st.markdown("---")
|
|
|
|
| 47 |
"Flights": flights * EMISSION_FACTORS["Flights"]
|
| 48 |
}
|
| 49 |
|
| 50 |
+
# Pie chart with green shades and percent labels
|
| 51 |
st.markdown("### 🧾 Activity-wise Contribution to Your Footprint")
|
| 52 |
+
|
| 53 |
+
green_colors = ['#006400', '#228B22', '#32CD32', '#7CFC00'] # dark to light green
|
| 54 |
fig = px.pie(
|
| 55 |
names=yearly_values.keys(),
|
| 56 |
values=yearly_values.values(),
|
| 57 |
title="Your Carbon Footprint Breakdown",
|
| 58 |
+
color_discrete_sequence=green_colors,
|
| 59 |
+
hole=0.3
|
| 60 |
)
|
| 61 |
+
fig.update_traces(textinfo='label+percent', textfont_size=16)
|
| 62 |
+
|
| 63 |
st.plotly_chart(fig, use_container_width=True)
|
| 64 |
|
| 65 |
st.markdown("---")
|