- I have 3 known positions onto a map using
X, Y matplotlib
using subplots, I need to plot a bearing from one of the towers and place a line onto the map. - I am currently using X, Y for start position and arrow/line for the end position. But would like to know how to use a bearing in place of the end of the line instead of x, y. I'm currently looking into Vectors but having no luck.
My code is below any help would be great
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import math
df = pd.read_csv("Book1.csv")
df.head()
tower1x = [51.69557]
tower1y = [-3.34197]
tower2x = [51.69673]
tower2y = [-3.34235]
tower3x = [51.69630]
tower3y = [-3.34090]
BBox = (df.longitude.min(), df.longitude.max(),
df.latitude.min(), df.latitude.max())
print (BBox)
ruh_m = plt.imread('map.png')
fig, ax = plt.subplots(figsize = (12,12))
ax.scatter(tower1x, tower1y, zorder=1, alpha= 0.5, c='red', s=50, label="Tower 1")
ax.scatter(tower2x, tower2y, zorder=1, alpha= 0.5, c='blue', s=50, label="Tower 2")
ax.scatter(tower3x, tower3y, zorder=1, alpha= 0.5, c='green', s=50, label="Tower 3")
ax.annotate("",xy=(51.69557,-3.34197), xytext=**(51.69799, -3.34155)**, textcoords='data',
arrowprops=dict(arrowstyle="<-", connectionstyle="arc3"),) # point from tower 1 using X,Y
ax.set_title('Plotting Towers in Aberfan')
ax.set_xlim(BBox[0],BBox[1])
ax.set_ylim(BBox[2],BBox[3])
ax.imshow(ruh_m, zorder=0, extent = BBox, aspect= 'equal')
plt.legend()
plt.show()