If I produce a scatter plot using df.hvplot.scatter(x='x', y='y', by='color', datashade=True, groupby='group') is there an easy way for me to get it to produce a legend even though the datashader option is on?
Ran into this today as well. At the very least, it would be great to have a note on Customization ā hvPlot 0.7.0 documentation about which options are mutually exclusive or ignored when datashade is set.
Continuing my previous example, this seems like a messy way to get a legend. Seems like this should be part of the library rather than creating a second plot and overlaying the first.
arr = []
for i in range(1, len(df.dayofweek.unique()) + 1):
arr.append(df[(df.carrier=='OO') & (df.dayofweek == i)].head(1))
minidf = pd.concat(arr)
minidf.hvplot.scatter(
x='arr_time',
y='dep_time',
by='dayofweek',
s=1
) * df[df.carrier=='OO'].hvplot.scatter(x='arr_time',
y='dep_time',
groupby='dayofweek',
datashade=True
)
Adding .opts(color_levels=7) to my rasterized plot object results in an error:
by_plot.opts(color_levels=7)
ValueError: Unexpected option ācolor_levelsā for NdOverlay type across all extensions. No similar options found.
The Holoviews help doesnāt seem to give any indication about color_levels
hv.help(by_plot)
Parameters of āDynamicMapā instance
Parameters changed from their default values are marked in red.
Soft bound values are marked in cyan.
C/V= Constant/Variable, RO/RW = ReadOnly/ReadWrite, AN=Allow None
ā¦
(continues on with a lot of items but color_levels is not included)
When printing my plot object this is what it tells me.
@philippjfr - Perhaps my recent comments are just due to lack of understanding of how to use new Holoviews features in hvPlot as mentioned in your Holoviews issue āAdd automatic categorical legend for datashaded plotsā
It was merged into main/master back in May of 2022.
Do you have any recommendations on how to take advantage of your code in hvPlot?
Thatās a great example of what can be done with Datashader. However, in my opinion, itās also an example of one of the limitations of Datashader: none of the graphics have a legend. The only way to understand the visualizations is to read the paragraphs of text.
I think, in the case of a single color, a carefully worded plot title/description could explain what is being shown. For those with multiple colors, the color_key should be a part of every plot instead of only in text/code: