vgosavi2 commited on
Commit
a169bc5
·
verified ·
1 Parent(s): 3ed582d

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +4 -0
src/streamlit_app.py CHANGED
@@ -325,6 +325,7 @@ fig = px.bar(
325
  x='RegionName',
326
  y='Count',
327
  color='crm_cd_desc',
 
328
  title='Top 5 Crimes by Region',
329
  labels={'crm_cd_desc': 'Crime Type'},
330
  height=600
@@ -463,6 +464,7 @@ the fluctuations and overall trajectories of these major crime categories across
463
 
464
 
465
  # -------------------------------- Plot 4: Map --------------------------------
 
466
  # Load the data.
467
  with open(GEOJSON_PATH, "r", encoding="utf-8") as f:
468
  geojson_data = json.load(f)
@@ -529,6 +531,7 @@ This visualization uses Folium to build an interactive map of crime distribution
529
  </div>""",unsafe_allow_html=True)
530
 
531
  # -------------------------------- Plot 4: Stacked Bar Chart --------------------------------
 
532
  # Group by crime type and year.
533
  stacked_year_df = df_top.groupby(['year', 'crm_cd_desc']).size().reset_index(name='count')
534
 
@@ -555,6 +558,7 @@ By observing the plot, we can find out that 2022 had the most crimes, the year h
555
  </div>""",unsafe_allow_html=True)
556
 
557
  # -------------------------------- Plot 5: Bar Chart --------------------------------
 
558
  # Group by crime type and year.
559
  heatmap1_df = df_top.groupby(['crm_cd_desc', 'year']).size().reset_index(name='count')
560
 
 
325
  x='RegionName',
326
  y='Count',
327
  color='crm_cd_desc',
328
+ color_discrete_sequence=px.colors.sequential.Agsunset,
329
  title='Top 5 Crimes by Region',
330
  labels={'crm_cd_desc': 'Crime Type'},
331
  height=600
 
464
 
465
 
466
  # -------------------------------- Plot 4: Map --------------------------------
467
+ st.markdown("<div class='sectionheader'> Explore LA Crime Patterns: An Interactive Folium Map </div>", unsafe_allow_html=True)
468
  # Load the data.
469
  with open(GEOJSON_PATH, "r", encoding="utf-8") as f:
470
  geojson_data = json.load(f)
 
531
  </div>""",unsafe_allow_html=True)
532
 
533
  # -------------------------------- Plot 4: Stacked Bar Chart --------------------------------
534
+ st.markdown("<div class='sectionheader'>Trends in Top 10 Crime Types (2020–2024)</div>", unsafe_allow_html=True)
535
  # Group by crime type and year.
536
  stacked_year_df = df_top.groupby(['year', 'crm_cd_desc']).size().reset_index(name='count')
537
 
 
558
  </div>""",unsafe_allow_html=True)
559
 
560
  # -------------------------------- Plot 5: Bar Chart --------------------------------
561
+ st.markdown("<div class='sectionheader'>Crime Rankings for Selected Year</div>", unsafe_allow_html=True)
562
  # Group by crime type and year.
563
  heatmap1_df = df_top.groupby(['crm_cd_desc', 'year']).size().reset_index(name='count')
564