Search code examples
cartopy

How to get smooth track around -180:180 longitude with SouthPolarStereo


I'd like to plot some tracks around polars with cartopy. When the track through -180:180 lat line, strange line are plotted.

The minimum example and plot is here.

import matplotlib.pyplot as plt
import cartopy.crs as ccrs

fig = plt.figure(figsize=[8, 8])
ax = fig.add_subplot(111, projection=ccrs.SouthPolarStereo())
ax.set_extent([-180, 180, -90, -60], ccrs.PlateCarree())
ax.gridlines(crs=ccrs.PlateCarree())
ax.coastlines()

ax.plot([135, 170, -170], [-71, -75, -75], marker='*', transform=ccrs.PlateCarree())

enter image description here

If I don't use line (i.e., lw=0, marker='.'), it is not an issue. Do you have more beautiful solution?


Solution

  • Try this instead.

    ax.plot([135, 170, -170], [-71, -75, -75],marker='*', transform=ccrs.Geodetic())