Skip to content

Commit

Permalink
new plot
Browse files Browse the repository at this point in the history
  • Loading branch information
GiacomoAru committed Nov 12, 2023
1 parent bdd8350 commit eb55cd6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions TASK_1/incidents_understanding_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ def update_legend_marker_size(handle, orig):
plt.scatter(df[lon], df[lat], color="k", s=3.0, label="Data points")
# plot circles with radius proportional to the outlier scores
radius = (df[info_circle].max() - df[info_circle]) / (df[info_circle].max() - df[info_circle].min())
radius_scale = 10
radius_scale = 100
scatter = plt.scatter(
df[lon],
df[lat],
Expand All @@ -823,13 +823,16 @@ def update_legend_marker_size(handle, orig):
plt.legend(
handler_map={scatter: HandlerPathCollection(update_func=update_legend_marker_size)}
)
plt.title("coordinates of city centroids + \'" + info_circle +'\'')
plt.title("coordinates of city centroids + " + info_circle)
plt.show()


# %%
plot_info_city(info_city, 'centroid_lat', 'centroid_lon', '75')

# %%
plot_info_city(info_city, 'centroid_lat', 'centroid_lon', 'tot_points')

# %%
plot_scattermap_plotly(info_city, 'tot_points', x_column='centroid_lat',
y_column='centroid_lon', hover_name=False, zoom=2, title='Number of points per city')
Expand All @@ -854,6 +857,11 @@ def substitute_city(row, info_city):

return row

# %%
dummy_df = incidents_df.loc[(incidents_df['latitude'].notna()) & (incidents_df['county'].notna()) & (incidents_df['city'].notna()) & (incidents_df['state'] == 'FLORIDA')]
print('Number of rows with null values for city, but not for lat/lon and county: ', len(dummy_df))
plot_scattermap_plotly(dummy_df, 'city', zoom=2, title='City')

# %%
if LOAD_DATA_FROM_CHECKPOINT:
incidents_df = load_checkpoint('checkpoint_2', date_cols=['date', 'date_original'])
Expand Down
2 changes: 1 addition & 1 deletion html/incidents_per_day.html

Large diffs are not rendered by default.

0 comments on commit eb55cd6

Please sign in to comment.