ralate2 commited on
Commit
214fa70
·
verified ·
1 Parent(s): 1cbfe7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -680,13 +680,13 @@ elif viz_type == "Complaints by Housing Block and Type (Incorporating Suggestion
680
  count = complaint_pivot.iloc[idx, i]
681
  percent = percentages.iloc[idx, i]
682
  if count > 0:
683
- # Compute the position for the percentage label
684
- x_pos = idx - 0.4 + 0.8 / 2 # Adjusting the position of the label
685
- y_pos = cumulative_height + count / 2
686
  ax.text(
687
  x_pos, y_pos, f"{percent:.1f}%",
688
  ha='center', va='center',
689
- fontsize=10, color='black',
690
  bbox=dict(facecolor='white', alpha=0.7, edgecolor='none')
691
  )
692
  cumulative_height += count
@@ -705,6 +705,7 @@ elif viz_type == "Complaints by Housing Block and Type (Incorporating Suggestion
705
  **Color Scheme:**
706
  The 'inferno' color palette is used to represent different complaint types, with darker shades indicating a higher frequency of complaints. The stacked bar chart makes it easy to compare the distribution of complaints by block and type.
707
  """)
 
708
  # Footer
709
  st.markdown("---")
710
  st.markdown("Dataset provided by the City of Urbana Open Data Portal - https://data.urbanaillinois.us/Environment/Nuisance-Complaints/tsn9-95m3/about_data ")
 
680
  count = complaint_pivot.iloc[idx, i]
681
  percent = percentages.iloc[idx, i]
682
  if count > 0:
683
+ # Compute the position for the percentage label within each segment
684
+ x_pos = idx # Adjusted to ensure it aligns with bar positions
685
+ y_pos = cumulative_height + count / 2 # Center within each segment
686
  ax.text(
687
  x_pos, y_pos, f"{percent:.1f}%",
688
  ha='center', va='center',
689
+ fontsize=10, color='black',
690
  bbox=dict(facecolor='white', alpha=0.7, edgecolor='none')
691
  )
692
  cumulative_height += count
 
705
  **Color Scheme:**
706
  The 'inferno' color palette is used to represent different complaint types, with darker shades indicating a higher frequency of complaints. The stacked bar chart makes it easy to compare the distribution of complaints by block and type.
707
  """)
708
+
709
  # Footer
710
  st.markdown("---")
711
  st.markdown("Dataset provided by the City of Urbana Open Data Portal - https://data.urbanaillinois.us/Environment/Nuisance-Complaints/tsn9-95m3/about_data ")