from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
m = Basemap(projection='cyl',resolution='c',area_thresh=10,llcrnrlon=-180,urcrnrlon=180,\
llcrnrlat=-90,urcrnrlat=90)
m.etopo()
Actually, I did not know how to provide the lat, lon, lat0, and lon0 parameters required to show scale-bar. How to provide them?
map.drawmapscale(????,barstyle='simple',units='km',fontsize=9,labelstyle='simple',fontcolor='k')
The tutorial at
http://matplotlib.org/basemap/api/basemap_api.html describe it as follows:
drawmapscale(lon, lat, lon0, lat0, length, barstyle='simple', units='km', fontsize=9, yoffset=None, labelstyle='simple', fontcolor='k', fillcolor1='w', fillcolor2='k', ax=None, format='%d', zorder=None)
Would appreciate if someone could help me.
ValueError: cannot draw map scale for projection='cyl'
. You cant make a scale in kilometers for a map in degrees, the length of a km is different at every location. – Kyanizedrawmeridians
anddrawparallels
will likely be more helpful than a scale bar for degrees. – Secede