Scatter Does Not Plot Any Points On Basemap
I have an array anomalies_ind that was created in this way: data_path = r'C:\Users\matth\Downloads\TRMM_3B42RT\3B42RT_Daily.201001.7.nc4' f = Dataset(data_path) latbounds = [ -45
Solution 1:
I've run into this problem, myself.
Basemap plotting functions have a latlon
keyword, and changing this worked for me. The default is latlon=False
, so that x and y values are interpreted as projection coordinates. Adding latlon=True
tells Basemap to interpret x and y values as map coordinates.
See the Basemap documentation on scatter here: http://matplotlib.org/basemap/api/basemap_api.html#mpl_toolkits.basemap.Basemap.scatter
In your original plotting syntax, you'll want to change the line:
m.scatter(longs, lat, marker = 'o', color = 'k', zorder=10)
to:
m.scatter(longs, lat, marker = 'o', color = 'k', zorder=10, latlon=True)
Solution 2:
You have to convert your latitudes ans longitudes to map projection before calling scatter:
x,y=m(longs,lat)
m.scatter(x, y, marker = 'o', color = 'k', zorder=10)
Post a Comment for "Scatter Does Not Plot Any Points On Basemap"