admin管理员组

文章数量:1023105

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())

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

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())

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

Share Improve this question edited Nov 19, 2024 at 7:30 DarkBee 15.5k8 gold badges72 silver badges118 bronze badges asked Nov 19, 2024 at 7:23 Keita MizukoshiKeita Mizukoshi 175 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Try this instead.

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

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())

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

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())

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

Share Improve this question edited Nov 19, 2024 at 7:30 DarkBee 15.5k8 gold badges72 silver badges118 bronze badges asked Nov 19, 2024 at 7:23 Keita MizukoshiKeita Mizukoshi 175 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Try this instead.

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

本文标签: cartopyHow to get smooth track around 180180 longitude with SouthPolarStereoStack Overflow