#282 Custom appearance of basemap

#282 Custom colors

The graph #281 shows how to draw a basic map with basemap. Here, I show how to improve its appearance. Each element that you draw on the map (boundary, continent, coast lines…) can be customised. Moreover, note that it is interesting to control the limits of the map, but we will learn more about this here.


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

# initialise the map
m=Basemap(llcrnrlon=-180, llcrnrlat=-60,urcrnrlon=180,urcrnrlat=70)

# Control the background color
m.drawmapboundary(fill_color='#A6CAE0', linewidth=0)

# Fill the continent
m.fillcontinents(color='grey', alpha=0.7, lake_color='grey')

# Draw the coastline
m.drawcoastlines(linewidth=0.1, color="white")

# to save if needed
#plt.savefig('PNG/#282_Custom_Basemap.png', dpi=110, bbox_inches='tight')

# Show
plt.show()

Leave a Reply

Your email address will not be published.