How can I plot a colorbar when plotting data from in datashader. I'm using vehicle data with position and heading (0-360*)
Minimal Datashader code:
import seaborn as sns, datashader as ds
from matplotlib.cm import ListedColormap
cmap = ListedColormap(sns.color_palette("hls", 8).as_hex())
agg = canvas.points(df, "longitude", "latitude", ds.mean("heading"))
img = tf.shade(agg, cmap=cmap, how="eq_hist")
img
This produces a colorful image with clear roads and directions, except it's impossible to tell without a legend which color maps to which direction.
At the moment I'm using Plotly to make the plot interactive as for some reason the holoviews/bokeh method is quite broken. This is the tutorial I followed to combine them: https://plot.ly/python/v3/change-callbacks-datashader/.