How to draw Africa-focused map using matplotlib basemap
Note that matplotlib basemap is deprecated in favour of cartopy ! Also see:
- How to draw Europe-focused map using matplotlib basemap
- How to draw North-America-focused map using matplotlib basemap
- How to draw South-America-focused map using matplotlib basemap
This code allows you to draw an map that is focused on Africa using matplotlib basemap:
my_map = Basemap(projection='ortho', lat_0=10, lon_0=13, resolution='l')
Complete example code
This code reproduces the image shown above:
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
my_map = Basemap(projection='ortho', lat_0=10, lon_0=13, resolution='l')
my_map.drawcoastlines(linewidth=1)
my_map.drawcountries(linewidth=0.5)
# Make plot larger
plt.gcf().set_size_inches(20, 10)
# Save to file
plt.savefig("Africa.svg")