【问题标题】:Plot Fine Grained Geodesic with Cartopy用 Cartopy 绘制细粒度测地线
【发布时间】:2020-03-14 17:05:40
【问题描述】:

以下代码(复制自here)在纽约市和新德里之间生成​​了一个漂亮的测地线。仔细检查后,测地线看起来并不平滑。我怎样才能使它看起来光滑?

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

ny_lon, ny_lat = -75, 43
delhi_lon, delhi_lat = 77.23, 28.61

ax = plt.axes(projection=ccrs.PlateCarree())
ax.stock_img()

plt.plot([ny_lon, delhi_lon], [ny_lat, delhi_lat],
         linewidth=2, marker='o', transform=ccrs.Geodetic())
plt.tight_layout()
plt.show()

【问题讨论】:

  • 对我的回答有什么意见吗?
  • @swatchai 太棒了,这正是我想要的!我只是不知何故错过了你的帖子。谢谢!!!!

标签: python-3.x cartopy


【解决方案1】:

您需要沿绘制的测地线设置更精细的线段阈值。这是执行此操作的相关代码行。

plateCr = ccrs.PlateCarree()
# print(plateCr._threshold) # original threshold=0.5
plateCr._threshold = plateCr._threshold/10.  #set finer threshold
ax = plt.axes(projection=plateCr)

换行:

ax = plt.axes(projection=ccrs.PlateCarree())

使用上面建议的代码。结果图应如下所示:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多