I'm having trouble creating a legend for the marker size of the map plot I've created. The marker size is based on the number of electric buses used at each location. I am trying to create a legend that has 3 entries for 1, 10, and 50 buses.
I have tried doing plt.legend(df.column_name, loc='lower left', scatterpoints=3)
. I expected this to make a legend with three examples from the column I specified. Instead I got 3 points that were overlayed on top of eachother. Below is the code I used and the result.
base = usa.plot(figsize=(20,20), edgecolor='white', linewidth=1)
points = busgp_data['geometry'].plot(ax=base,
color='gold',
marker='o',
markersize=12 * busgp_data['num_of_ESBs'],
edgecolor='black',
alpha=0.7)
plt.legend(busgp_data['num_of_ESBs'], loc='lower left', scatterpoints=3)
plt.title('Location of Electric School Buses in the US', fontdict={'fontsize':20})
plt.tick_params(
axis='both',
which='both',
bottom=False,
left=False,
labelleft=False,
labelbottom=False)