Reputation: 183
I have some points plotted on a NorthPolarStero map in Cartopy using the following code
fig, ax = plt.subplots(1,1,figsize=(8,8), subplot_kw={'projection': ccrs.NorthPolarStereo()})
ax.scatter([x[0] for x in max_coords[:-1]],
[x[1] for x in max_coords[:-1]],
color='k',
s=50,
marker='x',transform=ccrs.PlateCarree(),zorder=5,
label='BSH Center 1980-2020')
ax.set_extent([-180, 180, 90, 66], ccrs.PlateCarree())
ax.add_feature(cartopy.feature.LAND, edgecolor='black',zorder=1)
ax.legend(fontsize='x-large')
But I would actually like to plot just the top half of this image, like this:
If I change the ```ax.set_extent`` line to either:
[90, -90, 90, 66]
or
[-90, 90, 90, 66]
It just gives me the bottom half of the plot, like this:
Does anybody know how to get the top half? I have also tried setting the central_longitude
keyword of the NorthPolarStereo line to +/- 180, but it just shows the wrong half upside down.
Upvotes: 0
Views: 534
Reputation: 18812
To set extents for plotting the required area, you should use the coordinates of the projection in use ccrs.NorthPolarStereo()
. The relevant code you need is: –
ax.set_extent([-2.633e+06, 2.696e+06, -6e+04, 2.9e+06], crs=ccrs.NorthPolarStereo())
and you should get the plot similar to this:
Upvotes: 1