使用Python在地图上表示扇形图像

2024-09-28 17:17:39 发布

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

我希望使用下表作为输入,在地图上显示一个对象(扇形对象,每条突出的线与垂直方向呈“ID角”):

表格(输入): enter image description here

扇形物体:

enter image description here

我能够使用python在地图上显示一个点(非常简单)。到目前为止,我的问题是如何根据上述对象来表示每条突出的线。你知道吗

如果有任何帮助,我将不胜感激。你知道吗

更新

请看下面:

import matplotlib.pyplot as plt

longitude = [4.3323, 4.3323, 4.3323]
latitude = [2.3433, 2.3433, 2.3433]
x,y = map(longitude, latitude)
map.plot(x, y, 'bo', markersize=18)
plt.show()

所以基本上我可以用一个点来表示这些数据点。你知道吗

我需要整合方向性的改进,正如我之前所说的。你知道吗


Tags: 对象importidmapmatplotlib地图plt方向
1条回答
网友
1楼 · 发布于 2024-09-28 17:17:39

试试这个:

import numpy as np
import matplotlib.pyplot as plt

center = (4.3323, 2.3433)
angles = [60, 120, 240]
angles = [a/180.0*np.pi for a in angles]

# scale
l = 1

# the center point
x, y = center

# draw each line
for a in angles:
    dx = l * np.sin(a)
    dy = l * np.cos(a)
    plt.plot([x, x + dx], [y, y + dy], 'k-')

# draw the center circle
plt.plot(x, y, 'wo', ms=l*100)
plt.show()

相关问题 更多 >