基线图大圆纵向包裹和缺失数据问题

2024-04-27 15:15:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用for循环和一组lat/lon点来绘制多个大圆。我正在使用matplotlib的动画函数在更新数据源时更新绘图。这一切都很好。在

我注意到,在最短距离的地方画大圆圈包围图像,绘图将使用它并出现在地图的另一边。是否有理由阻止这一点?

另外,根据绘图的位置,我注意到绘图弧的“中间”缺失。是什么引起的?地图和代码如下:

CSV使用以下几点:(莫斯科和东京)

sourcelon   sourcelat   destlon    destlat
 55.44      37.51      -80.84      35.22
 139        35.6       -80.84      35.22

最小代码:

^{pr2}$

enter image description here


Tags: 函数代码绘图formatplotlib地方地图绘制
1条回答
网友
1楼 · 发布于 2024-04-27 15:15:26

作为wikipedia tells us

The great-circle distance or orthodromic distance is the shortest distance between two points on the surface of a sphere, measured along the surface of the sphere.

所以显示的路径走的是最短的距离,这可能是从图像的一边到另一边的。在

这条线中的缺失点有点神秘,但可能是使用的投影有一些问题。使用不同的投影,效果很好,例如projection='robin'

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt

fig = plt.figure(figsize=(8,6))
m = Basemap(projection='robin',lon_0=0,resolution='c')
m.drawcoastlines(color='grey', linewidth=1.0)

a = [[55.44, 37.51, -80.84, 35.22],[139, 35.6, -80.84, 35.22]]
x,y,z,w = a[0]
line, = m.drawgreatcircle(x,y,z,w,color='r')

plt.show()

enter image description here

如果增大点间距离,可以避免这个问题

^{pr2}$

会给予

enter image description here

另一个解决办法是从测线获取数据并手动绘制

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt

fig = plt.figure(figsize=(8,6))
m = Basemap(projection='mill', lon_0=0)
m.drawcoastlines(color='grey', linewidth=1.0)

a = [[55.44, 37.51, -80.84, 35.22],[139, 35.6, -80.84, 35.22]]
x,y,z,w = a[0]
line, = m.drawgreatcircle(x,y,z,w,color='r')
line.remove()
mx,my = line.get_data()
m.plot(mx,my, color="limegreen")

plt.show()

enter image description here

相关问题 更多 >