I have a data set which provides latitude, longitude, and temperature for a time series of oceanographic readings.
Right now I am plotting the trajectory through lat/lon space thus:
fig = plt.figure()
ax = fig.add_subplots(111)
ax.plot(lon, lat, 'o')
I want to have each dot display in a color representative of the temperature at that location (and display a colorbar). How would I go about doing this? If it's pertinent, this is actually a map from the basemaps toolkit. Thanks.
This was marked as duplicate; none of the solutions provided in the questions which it purportedly duplicates works.
Here is the code in its entirety:
map = Basemap(llcrnrlon = -160, llcrnrlat = -90, urcrnrlon = 40,
urcrnrlat = 10, resolution = 'l')
map.drawcoastlines()
map.drawcountries()
map.fillcontinents(color='gray')
map.drawmapboundary(
cs = map.scatter(lon,lat, c = temp[0])
plt.savefig('test.pdf')
plt.show()
It raises this error:
ValueError: Invalid RGBA argument: <xarray.DataArray 'TEMP' ()>
array(6.459000110626221)