I recently started using matplotlib's basemap. I want to create a transparent map with only borders, and this can be done with some basic projections like the miller projection in very simple code:
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
fig = plt.figure()
m = Basemap(projection='mill', lon_0=0)
m.drawcoastlines(color = '0.5',linewidth=0.2)
m.drawmapboundary(color='0.5', linewidth=0.2)
m.drawcountries(color='0.5', linewidth=0.2)
plt.savefig('**my folder**\\worldmap.png', dpi=350, transparent = True)
This generates a map that is completely transparent except for country borders and continent borders
However, the problem arises when I do the same with another projection, like the robinson projection, by replacing the 'mill' in line 6 with 'robin'. The resulting image has a white background instead of being transparent.
Can anyone help me with making other projections transparent as well? Or atleast confirm that there is no way to make some projections transparent?