I am making a figure with a map of East Anatrctica but Cartopy shows only western meridians by default.
midlon = -225
maxlon = midlon + 60
minlon = midlon - 60
minlat = -78
maxlat = -50
midlat = (minlat + maxlat) / 2
norm = mcolors.TwoSlopeNorm(vmin=0, vcenter=0.25, vmax=1)
projection = ccrs.Stereographic(central_longitude=midlon, central_latitude=midlat)
fig = plt.figure(figsize=(12, 6.5))
ax = plt.axes(projection=projection)
ax.add_feature(land_50m)
ax.coastlines(resolution="50m")
ax.set_extent([minlon, maxlon, minlat, maxlat], crs=ccrs.PlateCarree())
lons = X.sel(
{"xt_ocean": slice(minlon, maxlon), "yt_ocean": slice(minlat, maxlat)}
)
lats = Y.sel(
{"xt_ocean": slice(minlon, maxlon), "yt_ocean": slice(minlat, maxlat)}
)
boundary_path = make_boundary_path(lons, lats)
ax.set_boundary(boundary_path, transform=ccrs.PlateCarree())
gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True, x_inline=False, y_inline=False, linewidth=0.33, color='k',alpha=0.5)
gl.right_labels = gl.top_labels = False
If I add custom ticks:
gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True, x_inline=False, y_inline=False, linewidth=0.33, color='k',alpha=0.5)
gl.right_labels = gl.top_labels = False
gl.left_labels = gl.bottom_labels = True
gl.xlocator = mticker.FixedLocator([100, 120, 140, 160]) # Longitudes in degrees east
gl.ylocator = mticker.FixedLocator([-70, -60, -50]) # Latitudes
it shows only parts of parallels but no meridians.
I’d be happy just with ticks (not actual gridlines) at this point but I can’t figure out how to show eastern meridians in this case.