vgosavi2 commited on
Commit
81c56cb
·
verified ·
1 Parent(s): a169bc5

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +14 -1
src/streamlit_app.py CHANGED
@@ -302,7 +302,14 @@ for trace in fig.data:
302
  trace.update(mode="lines") # remove markers
303
 
304
  st.plotly_chart(fig, use_container_width=True)
305
- # -------------------------------- Plot 8: Line Chart for Incident Counts by Region --------------------------------
 
 
 
 
 
 
 
306
  st.markdown("<div class='sectionheader'>Crime Composition by Region: Top 5 Offenses </div>", unsafe_allow_html=True)
307
  # 1. Compute counts per region and crime
308
  counts = (
@@ -343,6 +350,12 @@ fig.update_layout(
343
 
344
  # 5. Render in Streamlit
345
  st.plotly_chart(fig, use_container_width=True)
 
 
 
 
 
 
346
 
347
  # -------------------------------- Plot 7: Bubble Map of Incident Counts by Region NO MAP --------------------------------
348
  # st.markdown("<div class='sectionheader'>Crime Hotspots by Region NO MAP</div>", unsafe_allow_html=True)
 
302
  trace.update(mode="lines") # remove markers
303
 
304
  st.plotly_chart(fig, use_container_width=True)
305
+ # Description.
306
+ st.markdown("""<div class="description"> This multi‐line chart tracks how total crime incidents have evolved across LAPD regions from 2020
307
+ through 2025. Each colored line represents a different precinct, letting you compare their trajectories side by side. You’ll notice that most
308
+ areas rose to a peak around 2022 before tapering off, while a handful of regions bucked the trend—either holding steady or dipping earlier. The
309
+ clear visual of converging and diverging lines makes it easy to spot which precincts saw the sharpest upticks, which managed to keep incidents
310
+ relatively flat, and how the overall pattern shifted over the five‐year span.</div>""",unsafe_allow_html=True)
311
+
312
+ # -------------------------------- Plot 8: Stacked Bar Charts for Regions --------------------------------
313
  st.markdown("<div class='sectionheader'>Crime Composition by Region: Top 5 Offenses </div>", unsafe_allow_html=True)
314
  # 1. Compute counts per region and crime
315
  counts = (
 
350
 
351
  # 5. Render in Streamlit
352
  st.plotly_chart(fig, use_container_width=True)
353
+ # Description.
354
+ st.markdown("""<div class="description"> This stacked‐bar chart breaks down each region’s crime profile by its five most common offenses. The bars’
355
+ layers show how certain neighborhoods are dominated by property crimes (like vehicle theft and petty theft), whereas others carry a heavier share of
356
+ violent or specialty offenses. By grouping all five slices together, the visualization highlights both the volume and mix of crimes in each area—revealing,
357
+ for example, precincts where assault plays a disproportionately large role versus those driven mainly by theft. This makes it straightforward to compare how
358
+ offense patterns differ from one region to the next.</div>""",unsafe_allow_html=True)
359
 
360
  # -------------------------------- Plot 7: Bubble Map of Incident Counts by Region NO MAP --------------------------------
361
  # st.markdown("<div class='sectionheader'>Crime Hotspots by Region NO MAP</div>", unsafe_allow_html=True)