The readshapefile method has been used and seems to be working fine:
m = Basemap(projection='robin', lon_0=0, resolution='c')
m.drawmapboundary(fill_color='cornflowerblue')
m.fillcontinents(color='white',lake_color='cornflowerblue', zorder=0)
m.drawcoastlines()
m.drawparallels(np.arange(-90.,120.,30.))
m.drawmeridians(np.arange(0.,420.,60.))
m.readshapefile(r'~/Desktop/ONGOING_PROJEKTS/MISC/PB2/PB2002_plates', name='PB2002_plates', drawbounds=True, color='orange')
#m.bluemarble()
lats = [38.3215, -55.285, -60.274]
lons = [142.36929, -31.877, -46.401]
x, y = m(lons, lats)
focmecs = [[193, 9, 78], [301, 62, 84], [190, 89, -140]]
eq_mw = [9.0, 7.4, 7.7]
ax = plt.gca()
for i in range(len(focmecs)):
# Loop to set the tensor (beach ball) colors
eq = eq_mw[i]
if eq < 6:
beachball_color = 'y'
elif 6 <= eq < 8:
beachball_color = 'orange'
elif 8 <= eq:
beachball_color = 'r'
b = beach(focmecs[i], facecolor=beachball_color, xy=(x[i], y[i]), width=1000000, linewidth=1, alpha=0.85)
b.set_zorder(10)
ax.add_collection(b)
However for a different map projection, for a different area (local not global), the background color of the map is changed:
m = Basemap(llcrnrlon=west, llcrnrlat=south, urcrnrlon=east, urcrnrlat=north, resolution='h', area_thresh = 0.1, projection='tmerc', lat_ts=0, lon_0=center[0], lat_0=center[1])
# Plot features
m.drawcoastlines()
m.drawcountries()
m.drawstates(color='w')
m.drawrivers(color='lightblue')
m.shadedrelief()
m.drawparallels(np.arange(-81., 81., 2),labels=[1,0,0,0], linewidth=0.0) #-81., 81., 4
m.drawmeridians(np.arange(-180., 181., 4),labels=[0,0,0,1], linewidth=0.0) #-180., 181., 10
m.readshapefile(r'~/Desktop/ONGOING_PROJEKTS/MISC/PB2/PB2002_plates', name='PB2002_plates', drawbounds=True, color='orange')
m.drawmapscale(146.3, 33.2, 145, 40, 500, barstyle='fancy')
It is not clear why, but this orange boundary seems to persist with the code for the second plot, but not the first. Does anyone know why?
I figured it out. Instead of:
change to
drawbounds=False
By setting it to false, you can then draw the local boundaries anyway.