Merge branch 'michelr_testing' into sebl

This commit is contained in:
SoulKindred 2024-01-08 10:50:16 +01:00
commit 42561cbbd9
2 changed files with 5 additions and 4 deletions

View File

@ -300,4 +300,4 @@ if __name__ == "__main__":
## Save Maps ============================================================================================ ## Save Maps ============================================================================================
save_map_as_html(toggle_map, "heat_map_toggle") save_map_as_html(toggle_map, "heat_map_toggle")
save_map_as_html(time_map, "heat_map_time") save_map_as_html(time_map, "html/heat_map_time")

View File

@ -73,6 +73,7 @@ def plt_acc_by_day_year(db):
animation_frame='year', animation_frame='year',
labels={'weekday': 'Weekday', 'count': 'Number of Accidents'}, labels={'weekday': 'Weekday', 'count': 'Number of Accidents'},
category_orders={'weekday': ['Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']}, category_orders={'weekday': ['Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']},
orientation='h'
) )
fig.update_yaxes(range=[0, 1000]) fig.update_yaxes(range=[0, 1000])
# Customize the layout to include a slider # Customize the layout to include a slider
@ -137,9 +138,9 @@ def plt_acc_by_daytime(db):
result = db.execute_query(acc_weekday_sql) result = db.execute_query(acc_weekday_sql)
result_df = pd.DataFrame(result) result_df = pd.DataFrame(result)
fig = px.bar(result_df, y='hour', x='count', orientation='h') fig = px.bar(result_df, y='hour', x='count', orientation='h', title='Accidents by day')
fig.write_image("fig/acc_by_day.png") fig.write_image("fig/acc_by_daytime.png")
fig.write_html("html/acc_by_day.html") fig.write_html("html/acc_by_daytime.html")
# Time Series charts ================================================================================================== # Time Series charts ==================================================================================================
def acc_by_type(db): def acc_by_type(db):