Hi @bbudescu,
I think what your looking for is half implemented or maybe more than half but is not all the way there just yet by the looks of it. Some code to demo, if it is all the way I’m not sure myself how to do but I’ve not really checked in on it in a while. I guess only other way might be to create manual legend, if possible monitor the selection of legend (I was looking at bokeh to see if possible, seen hints it maybe but hadn’t found anything concrete this evening) and trigger an appropriate re-plot from a callback.
The implementation I’m aware of is something like this I’ve come across and piece mealed together, it does allow me to click on the legend and hide the curves (edit: I’ve used hvplot, not sure if line, curve) however my take on the legend currently is it’s not very intuitive or visually fitting at this time in my opinion but kinda loosely works and may be enough
import pandas as pd
import numpy as np
import holoviews as hv
from holoviews.util.transform import dim
from holoviews.selection import link_selections
from holoviews import opts
from holoviews.operation.datashader import shade, rasterize
import hvplot.pandas
hv.extension('bokeh', width=100)
## create random walks (one location) ##
data_df = pd.DataFrame()
npoints=15000
np.random.seed(71)
x = np.arange(npoints)
y1 = 1300+2.5*np.random.randn(npoints).cumsum()
y2 = 1500+2*np.random.randn(npoints).cumsum()
y3 = 3+np.random.randn(npoints).cumsum()
data_df.loc[:,'x'] = x
data_df.loc[:,'rand1'] = y1
data_df.loc[:,'rand2'] = y2
data_df.loc[:,'rand3'] = y3
data_df.hvplot(x='x', y=['rand1', 'rand2', 'rand3'], value_label='y', width=800, height=400)
df = data_df.drop(['x'],1)
red = df['rand1'].hvplot(value_label='y',
width=800,
height=400,
rasterize=True,
cmap=['red'],
colorbar=False)
green = df['rand2'].hvplot(value_label='y',
width=800,
height=400,
rasterize=True,
cmap=['green'],
colorbar=False)
blue = df['rand3'].hvplot(value_label='y',
width=800,
height=400,
rasterize=True,
cmap=['blue'],
colorbar=False)
layout = red * green * blue
layout
Hi @CrashLandonB,
The answer I believe lies in the link @bbudescu posted in original question. My simple understanding is by using rasterize inbuilt to hvplot/holoviews information is exposed to bokeh that then takes care shading aspect and legend aspects to some extent. By using datashader (which is rasterize + shade from what I take) you bypass some of the plotting features offered by bokeh. So by using datashader specifically you won’t get some of the features you’ll gain by using rasterize, I think it mentions to make use of rasterize where possible.
Hope of some help, thanks Carl.