Spaces:
Build error
Build error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +2 -2
src/streamlit_app.py
CHANGED
|
@@ -350,7 +350,7 @@ year_slider = alt.binding_range(min=heatmap1_df['year'].min(), max=heatmap1_df['
|
|
| 350 |
year_select = alt.selection_point(fields=['year'], bind=year_slider, name="Select")
|
| 351 |
|
| 352 |
# Convert the heatmap into bar chart.
|
| 353 |
-
|
| 354 |
x=alt.X('crm_cd_desc:N', title='Crime Type', sort='-y'),
|
| 355 |
y=alt.Y('count:Q', title='Number of Incidents'),
|
| 356 |
color=alt.Color('crm_cd_desc:N', title='Crime Type'),
|
|
@@ -366,7 +366,7 @@ heatmap1 = alt.Chart(heatmap1_df).mark_bar().encode(
|
|
| 366 |
)
|
| 367 |
|
| 368 |
# Display the plot.
|
| 369 |
-
|
| 370 |
|
| 371 |
st.markdown("This heatmap shows the frequency of the top 10 crimes from 2020 to 2025. The x axis is year nd the y axis is crime type. The colormap is "YlOrRd" to create a distinct visual difference in number of incidents. Dark red means that the incident frequency is high while light yellow means that the incident frequency is low. 'Vehicle Stolen' seems to be the most prevalent crime for all five years, given its values are highlighted in deeper shades of red. 'Vehicle Stolen' also seems to fluctuate between 20000 and 24000 throughout the five years. 'Thief of identity' also saw a spike in incident frequency for 2022, recording 21251 crimes. Limiting the heatmap to top 10 crimes addressed the most prominent crimes in LA. Since 2025 is not over, data for that year is still relatively inclusive. This visualization can help law enforcement easily detect trends of different crimes for a specific year. This data may allow them to predict future rates and be able to allocate resources accordingly to mitigate these crimes.")
|
| 372 |
|
|
|
|
| 350 |
year_select = alt.selection_point(fields=['year'], bind=year_slider, name="Select")
|
| 351 |
|
| 352 |
# Convert the heatmap into bar chart.
|
| 353 |
+
barchart = alt.Chart(heatmap1_df).mark_bar().encode(
|
| 354 |
x=alt.X('crm_cd_desc:N', title='Crime Type', sort='-y'),
|
| 355 |
y=alt.Y('count:Q', title='Number of Incidents'),
|
| 356 |
color=alt.Color('crm_cd_desc:N', title='Crime Type'),
|
|
|
|
| 366 |
)
|
| 367 |
|
| 368 |
# Display the plot.
|
| 369 |
+
barchart
|
| 370 |
|
| 371 |
st.markdown("This heatmap shows the frequency of the top 10 crimes from 2020 to 2025. The x axis is year nd the y axis is crime type. The colormap is "YlOrRd" to create a distinct visual difference in number of incidents. Dark red means that the incident frequency is high while light yellow means that the incident frequency is low. 'Vehicle Stolen' seems to be the most prevalent crime for all five years, given its values are highlighted in deeper shades of red. 'Vehicle Stolen' also seems to fluctuate between 20000 and 24000 throughout the five years. 'Thief of identity' also saw a spike in incident frequency for 2022, recording 21251 crimes. Limiting the heatmap to top 10 crimes addressed the most prominent crimes in LA. Since 2025 is not over, data for that year is still relatively inclusive. This visualization can help law enforcement easily detect trends of different crimes for a specific year. This data may allow them to predict future rates and be able to allocate resources accordingly to mitigate these crimes.")
|
| 372 |
|