1

I need to plot some data over a map of the city of Amsterdam, but I can't get Basemap to display the proper plot. With the code below, all I get is an empty plot and I don't know how to get the map to display.

My code is below:

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
%matplotlib inline

#Create a map around Amsterdam
#http://www.latlong.net/
#Upper Right Corner 52.4268763,5.2415393
#Lower Left Corner 52.3303609,4.6992733

#fig, ax = plt.subplots()
m = Basemap(projection='merc', 
        llcrnrlat=52.3303609,urcrnrlat=52.4268763,
        llcrnrlon=4.6992733, urcrnrlon=5.2415393,
        resolution='c')

m.fillcontinents()
m.drawcoastlines()
m.drawmapboundary()
plt.show()

What am I missing in my code?

2
  • 1
    You are missing the actual plot command -- where should the actual data for your map come from? Commented Jul 4, 2017 at 6:07
  • @Thomas I guess he means the coastlines which are not shown. Additional data must of course be drawn seperately. Commented Jul 4, 2017 at 8:17

1 Answer 1

2

The resolution you chose for the basemap, resolution='c' is "coarse", meaning that detailed coastlines will not be shown. You can use any of the other possible resolutions

l (low), i (intermediate), h (high), f (full)

Example:

resolution="l":
enter image description here

resolution="i":
enter image description here

resolution="h":
enter image description here

resolution="f":
enter image description here

Code to reproduce:

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt

m = Basemap(projection='merc', 
        llcrnrlat=52.3303609,urcrnrlat=52.4268763,
        llcrnrlon=4.6992733, urcrnrlon=5.2415393,
        resolution="f")

m.fillcontinents(color='bisque')
m.drawcoastlines()
m.drawmapboundary(fill_color='lightcyan')

plt.show()
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.