matplotlib / basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib
MIT License
775 stars 392 forks source link

small bug in drawmapscale #368

Open martalmeida opened 7 years ago

martalmeida commented 7 years ago

When using fancy style, the argument ax is not passed to self.plot while plotting the frame and ticks, ex:

plot bottom line

rets.append(self.plot([x1,x4],[ybottom,ybottom],color=fontcolor)[0])

Thus, part of the map scale may be plotted in a different axes. Ex:

import pylab as pl
from mpl_toolkits.basemap import Basemap
m = Basemap(width=3000e3,height=3000e3,resolution='l',
         projection='lcc',lat_1=50.,lat_0=47,lon_0=1.)

ax0=pl.axes()
ax1=pl.axes([.6,.5,.15,.15])
m.drawcoastlines(ax=ax0)
lon,lat=-15,47
lon0,lat0=lon,lat
scaleL=400
#pl.axes(ax0) #this will avoid the problem...
o=m.drawmapscale(ax=ax0,lon=lon,lat=lat,lon0=lon0,lat0=lat0,
                   length=scaleL,barstyle='fancy',fontcolor='r')