I am trying to plot lines and markers from a CSV file on a map using matplotlib.
Data:
AL99,2017080912,SHIP,0,17.1,-55.6,25,0
AL99,2017080912,SHIP,12,18.1,-57.6,27,0
AL99,2017080912,SHIP,24,19.0,-59.2,29,0
AL99,2017080912,SHIP,36,20.1,-60.2,34,0
AL99,2017080912,SHIP,48,21.5,-61.6,39,0
AL99,2017080912,SHIP,60,23.3,-63.0,47,0
AL99,2017080912,SHIP,72,25.4,-65.2,54,0
AL99,2017080912,SHIP,84,27.9,-68.1,61,0
AL99,2017080912,TABD,0,17.1,-55.7,0,0
AL99,2017080912,TABD,6,17.5,-56.7,0,0
AL99,2017080912,TABD,12,17.8,-57.3,0,0
AL99,2017080912,TABD,18,18.1,-57.9,0,0
AL99,2017080912,TABD,24,18.5,-58.3,0,0
AL99,2017080912,TABD,30,19.0,-58.6,0,0
AL99,2017080912,TABD,36,19.6,-58.8,0,0
Python Code:
tc = np.recfromcsv(csv_file, unpack=True, names=['stormid', 'initdate', 'mems', 'times', 'tclat', 'tclon', 'tcwind', 'tcpres'], dtype=None)
for j in range(len(tc.times)):
lon, lat = tc.tclon[j], tc.tclat[j]
xpt, ypt = m(lon, lat)
lonpt, latpt = m(xpt, ypt, inverse=True)
if tc.mems[j] == 'TABD':
tccolor = '--bo'
elif tc.mems[j] == 'AEMN':
tccolor = '-ro'
else:
tccolor = '-k'
m.plot(xpt, ypt, tccolor)
Result:
I am getting the markers to correctly plot with color but, the lines are not there.


m?) and incorrectly formatted (no indent after theforloop). Besides, your data doesn't seem to match your plot (for example, yourlatin data is only between 15 and 20; yet your plot looks like on Atlantic with lat at least up to 40). So your question might be difficult for others to troubleshoot and help.