Reputation: 201
I have lat/long data points I am trying to plot on a map using Matplotlib's Basemap. Several points are not showing up and I am not sure why.
I tried to simplify my code as much as possible in order to understand where the issue is occurring.
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
lat = [39.62, 38.97, 40.75, 41.19]
lon = [-121.76, -78.38, -87.66, -104.91]
fig = plt.figure(figsize=(18,18))
m=Basemap(projection='cea')
m.drawcoastlines()
m.fillcontinents()
m.drawmapboundary()
m.scatter(lat,lon,zorder=10,latlon=True)
I attached the image of the result. I applied the solutions to two other questions:
I also tried
x,y = m(lat,lon)
m.scatter(x,y,zorder=10)
yet nothing showed up. I couldn't find any other reasons why datapoints won't show up. I confirmed in Google Maps that these are valid lat/lon coordinates that should show up in USA.
What am I missing?
Upvotes: 3
Views: 1791