Last active
September 24, 2020 12:08
-
-
Save kboghe/a2ee856013df4cdd231b2f74cb519995 to your computer and use it in GitHub Desktop.
plotting paris
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import geopandas | |
| f, axs = plt.subplots(1,1, figsize=(90, 135),sharex=False,sharey=False) | |
| loc = ['Paris_map.geojson'] #area to plot | |
| fileloc = "maps/"+ loc[0] #folder containing all maps | |
| map = geopandas.read_file(fileloc) #read the map | |
| map.plot(ax=axs,linewidth=0.1) | |
| axs.axis('off') | |
| city = geos_locinfo[(geos_locinfo['search input'] == 'Paris') & (geos_locinfo.category_aggregated.isin(['restaurant','supermarket']))] | |
| colors = {'restaurant':'darkorange', 'supermarket':'olivedrab'} | |
| f.suptitle(str(loc[0].replace("_map.geojson","") + "- N:" + str(len(city))),fontsize=11,weight='bold') | |
| gdf = geopandas.GeoDataFrame(city, geometry=geopandas.points_from_xy(city.long, city.lat)) | |
| gdf.plot(ax=axs, color=city.category_aggregated.apply(lambda x: colors[x]),markersize=6,alpha=1,legend=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment