Update app.py
Browse files
app.py
CHANGED
@@ -166,13 +166,16 @@ def main():
|
|
166 |
st.write(intervention_stats)
|
167 |
|
168 |
# Two-column layout for the visualization and intervention frequency
|
169 |
-
col1, col2 = st.columns([
|
170 |
|
171 |
with col1:
|
172 |
intervention_fig = plot_intervention_statistics(intervention_stats)
|
173 |
|
174 |
with col2:
|
175 |
intervention_frequency = intervention_stats['Intervention Frequency (%)'].values[0]
|
|
|
|
|
|
|
176 |
st.markdown(f"<h1 style='color: #358E66;'>{intervention_frequency}%</h1>", unsafe_allow_html=True)
|
177 |
|
178 |
# Add download button for Intervention Session Statistics chart
|
@@ -271,7 +274,9 @@ def plot_intervention_statistics(intervention_stats):
|
|
271 |
|
272 |
# Update chart settings
|
273 |
ax.set_ylabel('Frequency')
|
274 |
-
|
|
|
|
|
275 |
st.pyplot(fig)
|
276 |
|
277 |
return fig
|
|
|
166 |
st.write(intervention_stats)
|
167 |
|
168 |
# Two-column layout for the visualization and intervention frequency
|
169 |
+
col1, col2 = st.columns([3, 1]) # Set the column width ratio
|
170 |
|
171 |
with col1:
|
172 |
intervention_fig = plot_intervention_statistics(intervention_stats)
|
173 |
|
174 |
with col2:
|
175 |
intervention_frequency = intervention_stats['Intervention Frequency (%)'].values[0]
|
176 |
+
# Display the "Intervention Frequency (%)" text
|
177 |
+
st.markdown("<h2 style='color: #358E66;'>Intervention Frequency (%)</h2>", unsafe_allow_html=True)
|
178 |
+
# Display the frequency value below it
|
179 |
st.markdown(f"<h1 style='color: #358E66;'>{intervention_frequency}%</h1>", unsafe_allow_html=True)
|
180 |
|
181 |
# Add download button for Intervention Session Statistics chart
|
|
|
274 |
|
275 |
# Update chart settings
|
276 |
ax.set_ylabel('Frequency')
|
277 |
+
# Reverse the legend order to match the new stacking order
|
278 |
+
handles, labels = ax.get_legend_handles_labels()
|
279 |
+
ax.legend(handles[::-1], labels[::-1])
|
280 |
st.pyplot(fig)
|
281 |
|
282 |
return fig
|