Python 如何根据底图上的地理坐标指向箭头框?

Python 如何根据底图上的地理坐标指向箭头框?,python,dictionary,matplotlib-basemap,Python,Dictionary,Matplotlib Basemap,我试图画一个指向特定坐标的箭头框,但它不准确。箭头的头部应该指向散射形成的点。我怎样才能解决这个问题? 这是我的密码: fig, axes = plt.subplots(figsize=(15, 15)) m = Basemap(projection='merc', llcrnrlat = 39, urcrnrlat = 59, llcrnrlon = -10, urcrnr

我试图画一个指向特定坐标的箭头框,但它不准确。箭头的头部应该指向散射形成的点。我怎样才能解决这个问题? 这是我的密码:

fig, axes = plt.subplots(figsize=(15, 15))
m = Basemap(projection='merc',
               llcrnrlat = 39, 
               urcrnrlat = 59,
               llcrnrlon = -10,
               urcrnrlon = 45,
               resolution='l',lat_0 = 58.9, lon_0 = 25.3,
               ax=axes)
m.drawcoastlines(linewidth=0.9)
m.drawcountries(color='blue')
m.drawmapboundary(fill_color='aqua')
m.fillcontinents(color='lightgreen')

# x, y = m(51, 4, inverse=True)
# x2, y2 = m(50, 6, inverse=True)
bbox1 = dict(boxstyle='{},pad={}'.format('rarrow', 1), fc='green', ec='green', lw=5)
axes.annotate('text',xy=m(cities['LOCATION x'].iloc[0], cities['LOCATION y'].iloc[0]) , xycoords='data', rotation=20, ha='right', va='bottom', color='black',
                     xytext=(cities['LOCATION x'].iloc[0], cities['LOCATION y'].iloc[0]), textcoords='offset points', fontsize=10, weight=1000,
                    bbox=bbox1,)
m.scatter(cities['LOCATION x'].iloc[0], cities['LOCATION y'].iloc[0], latlon=True, s=200,
                  marker='o', alpha=1, zorder=2, color='blue')
plt.show()

初始化箭头时,您是否尝试过从其位置减去箭头的宽度和高度?@Bonfire否,但如何获得箭头的大小?要告诉您,您需要向我显示创建箭头的代码。我不知道它是否包含在您的代码中。我建议您在此处使用这些值。这不是一个非常有效的方法,但我会尝试。如果你不想这样做,你首先要知道的是箭头的尺寸。你有没有尝试过在初始化箭头时从其位置减去箭头的宽度和高度?@Bonfire没有,但是如何获得箭头的大小?告诉你,您需要向我显示创建箭头的代码。我不知道它是否包含在您的代码中。我建议您在此处使用这些值。这不是一个非常有效的方法,但我会尝试。如果您不想这样做,那么首先应该了解箭头的尺寸。