I have the following sorted DataFrame (the numbers are completely random):
In[1]: df
Out[1]:
Total Count
Location 1 20 5
Location 2 15 4
Location 3 13 3
...
Location 10 1 1
Each location has a latitude and longitude.
I would like to plot these locations on a map using circles. The radius of the circles needs to correspond to the amount in Total
. In other words, Location 1 needs to have the biggest circle, Location 2 a smaller one, etc.
Also, I would like to have a transition in colors. The biggest circle in red, the next one in orange, the next one in yellow, etc.
Lastly, I would like to make an annotation next to each circle.
I managed to draw blue dots on the map, but I don't know how to draw the circles with the corresponding size and color.
This is my code so far:
m = Basemap(resolution='i', projection='merc', llcrnrlat=49.0, urcrnrlat=52.0, llcrnrlon=1., urcrnrlon=8.0, lat_ts=51.0)
m.drawcountries()
m.drawcoastlines()
m.fillcontinents()
for row_index, row in df.iterrows():
x, y = db.getLocation(row_index)
lat, lon = m(y, x)
m.plot(lat, lon, 'b.', alpha=0.5)
#This draws blue dots.
plt.title('Top 10 Locations')
plt.show()