### Setup figure
fig = plt.figure(figsize=[ 9, 7])
### Setup panels
gs1 = gridspec.GridSpec(2, 2, width_ratios=[1.3,0.0001], height_ratios=[0.0001,1.3])
gs2 = gridspec.GridSpec(2, 2, width_ratios=[1.2,1.25], height_ratios=[1.25,1.2])
'''
Regional plot (Panel a)
'''
ax2 = fig.add_subplot(gs1[1,0],
projection=ccrs.Stereographic(central_longitude=0.,
central_latitude=-90.) )
extent = {'west':277.5, 'south':-82.5, 'east':311.25, 'north':-57.5}
ax2.set_extent([extent['west'],extent['east'],extent['south'],extent['north']],
ccrs.PlateCarree())
### Plot ice sheet elevation
if plot_elev:
### https://secure.antarctica.ac.uk/data/bedmap2/bedmap2_readme.txt
bedmap = rockhound.fetch_bedmap2(datasets=["surface"])
pc = bedmap.surface.plot.pcolormesh(
ax=ax2, cmap='Blues_r',
cbar_kwargs=dict(pad=0.03, fraction=0.036, orientation='horizontal',
label='elevation (m)'),
vmin=0, vmax=2000 )
else:
plot_ice_masses(ax2)
### Draw regional Box
if draw_regional_box: draw_box(regional_box)
grid_dx = 5
grid_dy = 2
ax2.gridlines( xlocs=np.arange(-180,180,grid_dx), ylocs=np.arange(-90, 0, grid_dy),
color='Grey', linestyle=':', linewidth=0.5,
transform=ccrs.PlateCarree() )
grid_labels_lons = np.arange(280,310,5)
grid_labels_lats = np.arange(-78, -60, 2)
for lon in grid_labels_lons:
if lon > 180.: lon = (360. - lon).astype(int)
txt = ax2.text( -lon, -59., str(lon)+u'\260W', transform=ccrs.PlateCarree(),
ha='center', va='bottom', rotation=lon-90., rotation_mode='anchor',
size='large')
txt.set_path_effects([PathEffects.withStroke(linewidth=1.3, foreground='w')])
for lat in grid_labels_lats:
txt = ax2.text( 314, lat, str(-lat)+u'\260S', transform=ccrs.PlateCarree(),
ha='center', va='center', size='large',
bbox={'facecolor':'none','edgecolor':'none','pad':0.5} )
txt.set_path_effects([PathEffects.withStroke(linewidth=1.3, foreground='w')])
### Plot location label
Rothera = [360.-68.07, -67.43]
ax2.plot(Rothera[0], Rothera[1], color='r', marker='o', markeredgewidth=1.0, markersize=5.,
transform=ccrs.PlateCarree())
at_x, at_y = ax2.projection.transform_point(Rothera[0], Rothera[1],
src_crs=ccrs.PlateCarree())
txt1 = ax2.annotate('Rothera', xy=(at_x, at_y), xytext=(-30., -22.), xycoords='data',
textcoords='offset points', color='r', size='xx-large')
txt1.set_path_effects([PathEffects.withStroke(linewidth=1.3, foreground='w')])
### Plot panel label
ax2.add_artist(AnchoredText('a', loc=2, borderpad=0.0, prop=dict(size=16) ))
'''
Antarctic Plot (Panel b)
'''
ax2 = fig.add_subplot(gs2[0,1],
projection=ccrs.Stereographic(central_longitude=0.,
central_latitude=-90.) )
# Compute a circle in axes coordinates, which we can use as a boundary
# for the map. We can pan/zoom as much as we like - the boundary will be
# permanently circular.
theta = np.linspace(0, 2*np.pi, 100)
center, radius = [0.5, 0.5], 0.5
verts = np.vstack([np.sin(theta), np.cos(theta)]).T
circle = mpath.Path(verts * radius + center)
ax2.set_boundary(circle, transform=ax2.transAxes)
lat_extend = -55
ax2.set_extent([0, 359, -80, lat_extend], ccrs.PlateCarree())
plot_ice_masses(ax2)
### Draw regional Box
if draw_regional_box: draw_box(regional_box)
# ax2.gridlines(
# xlocs=np.arange(0,361,30),
# ylocs=np.arange(-90, 0, 10), color='Grey',
# linestyle=':', linewidth=0.5,
# transform=ccrs.PlateCarree() )
# # add grid labels
# for lon in range(0,360,180):
# ax2.text( -lon, lat_extend, str(lon)+u'\260', transform=ccrs.PlateCarree(),
# ha='center', va='bottom', rotation=lon, rotation_mode='anchor',
# size='large')
# for lon in range(30,180,30):
# ax2.text( lon, lat_extend, str(lon)+u'\260E', transform=ccrs.PlateCarree(),
# ha='center', va='bottom', rotation=-lon, rotation_mode='anchor',
# size='large')
# for lon in range(30,180,30):
# ax2.text( -lon, lat_extend, str(lon)+u'\260W', transform=ccrs.PlateCarree(),
# ha='center', va='bottom', rotation=lon, rotation_mode='anchor',
# size='large')
# for lat in range(-80,lat_extend,10):
# txt = ax2.text( 120, lat, str(-lat)+u'\260S', transform=ccrs.PlateCarree(),
# ha='center', va='center', size='large',
# bbox={'facecolor':'none','edgecolor':'none','pad':0.5} )
# txt.set_path_effects([PathEffects.withStroke(linewidth=1.3, foreground='w')])
### Add markers
AntLabels = [ 'AP' ] # , 'BS', 'WS' , 'WAIS' ]
AntLons = [ -56. ] #, -89., -35., -106. ]
AntLats = [ -68. ] #, -68., -73. , -82. ]
rotation = [ -30. ] #, -0. , 0. , 0. ]
for i2 in range(len(AntLabels)):
font_size=8
if AntLabels[i2] == 'WAIS': font_size=font_size+4
at_x, at_y = ax2.projection.transform_point( AntLons[i2], AntLats[i2], src_crs=ccrs.PlateCarree() )
txt = ax2.annotate(AntLabels[i2], xy=(at_x, at_y),
color='k', rotation=rotation[i2],
ha='center', va='center', size=font_size)
txt.set_path_effects([PathEffects.withStroke(linewidth=1.3, foreground='w')])
# Add panel label to top right
ax2.add_artist(AnchoredText('b', loc=2, borderpad=0.0, prop=dict(size=14) ))
'''
Make plot
'''
# plt.tight_layout()
plt.savefig('annotated_map.jpg', dpi=300)