#281 Basic map with basemap

#281 Most basic background map

Here is the most basic map you can do with the basemap library of python. It allows to understand the basic use of this library. Always start by initialising the map with the Basemap() function. Then, add the elements your needs, like continents, coastlines… Since this basemap is not really gorgeous, I propose you to custom it easily.


# libraries
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt

# Always start witht the basemap function to initialize a map
m=Basemap()

# Then add element: draw coast line, map boundary, and fill continents:
m.drawcoastlines()
m.drawmapboundary()
m.fillcontinents()

# You can add rivers as well
#m.drawrivers(color='#0000ff')

plt.show()

Leave a Reply

Your email address will not be published.