I am trying to plot a polar stereographic map using cartopy in Python. I am able to plot the map successfully, but I am having trouble showing the grid labels.
Here is my code:
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.path as mpath
fig = plt.figure(figsize =(12,8))
ax = plt.axes(projection=ccrs.SouthPolarStereo())
ax.set_extent([-180,180,-90,-30], ccrs.PlateCarree())
ax.add_feature(cfeature.LAND, color='darkgrey')
ax.add_feature(cfeature.OCEAN, color= 'lightblue')
ax.add_feature(cfeature.COASTLINE, linewidth=1.25)
ax.gridlines(ccrs.PlateCarree(), draw_labels=True, linewidth=0.5,
color='grey', xlocs = np.arange(-180,180,30),ylocs = np.arange(-85,-30,20))
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)
ax.set_boundary(circle, transform = ax.transAxes)
plt.tight_layout()
plt.show()
This produces a map with gridlines, but the labels are not shown. How can I show the labels for the gridlines?
Thank you for your help!