I am using matplotlib basemap to plot a trajectory from data in a pandas dataframe.
Simply plotting lat, lon data as below works fine:
map = Basemap(projection='stere',lon_0=lon,lat_0=lat, llcrnrlon=-65, llcrnrlat=55, urcrnrlon=50 , urcrnrlat=75)
map.drawcountries()
map.bluemarble()
#Place marker at Kangerlussuaq
x,y = map(lon, lat)
map.plot(x, y, 'bo', markersize=10)
plt.text(x, y, ' Kangerlussuaq', fontsize=12)
#Plot trajectory
map.plot(datacopy.long.tolist(),
datacopy.lat.tolist(),
'r-',
latlon=True)
However, I want parts of the trajectory to be plotted with a different marker depending on the ambient temperature measured at each lat/lon but the following code gives me the error:
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
if datacopy['Ambient temp']<280:
map.plot(datacopy.long.tolist(),
datacopy.lat.tolist(),
'r-',
latlon=True)
else:
map.plot(datacopy.long.tolist(),
datacopy.lat.tolist(),
'b-',
latlon=True)
Is this error due to the data being in a pandas dataframe and is there a way around it?
Thanks