I am trying to label each point on this scatter plot with its name. So far - all my annotations end up in the bottom left corner. the plot How can I label each point? I see that other question that is similar but that is the question I used to create this code that isn't working... I not very good with for loops. I am not sure I set this one up correctly and if so, why won't it get the well names from my df and plot them based on their lat/lon?
this is the code I have:
from mpl_toolkits.basemap import Basemap
f, ax = plt.subplots(1,1,figsize=(20,20))
m = Basemap(llcrnrlon = 2.4,llcrnrlat =60.11,urcrnrlon=3.3,urcrnrlat=60.91,epsg = 5939,
resolution = 'h')
lat = df['Latitude '].values
lon = df['Longitude'].values
wells = df['Well_Name'].values
x,y = m(lon,lat)
for i in range(len(lat)):
plt.scatter(x, y, marker = 'o', c= df.Over_Pressure_MPa, cmap = "inferno_r", s = 200 )
for i, label in enumerate(wells):
plt.annotate(label, (lat[i], lon[i]))
m.drawmapboundary(fill_color=None)
m.fillcontinents(color=None,lake_color='aqua')
m.drawcoastlines()
plt.colorbar(label=r'Over Pressure')
plt.show()