hvplot
hvplot copied to clipboard
Document usage of the HoloViews `decimate` operation
Would it make sense to have a decimate keyword, similar to datashade/rasterize?
Does someone know a solution for decimate when using hvplot? I visualize many points with datashader and use an additional hv.point layer with decimate to get hover information for a subset of points. (example: https://examples.pyviz.org/uk_researchers/uk_researchers.html )
I don't know how to configure decimate in hvplot.scatter. My code for the datashader layer at the moment:
settings = {
'height': 500,
'width': 900,
'color': "red",
'tools': [hover],
'datashade': True,
'dynspread': True
#'active_tools': ['wheel_zoom']
}
df_source.hvplot.scatter('x','y', **settings)
For the hover points layer i would like to use something like 'decimate': True. But i do not know either how to configure additional parameters for decimate like max_samples.
Also i noticed that active_tools is not available in Scatter. Normally i enable wheel_zoom by default with this parameter.
decimate is a HoloViews operation designed to work with HoloViews objects, so since the output of .hvplot() is generally a HoloViews object (with a few exceptions), you should be able to do from holoviews.operation import decimate ; decimate(df_source.hvplot.scatter('x','y', **settings), max_samples=5000).
I think adding active_tools as an hvPlot keyword is a good feature request, but in the meantime you should be able to do it by adding .opts(active_tools=['wheel_zoom']) to the end of that.
@jbednar ah thanks a lot! The decimate() and active_tools solution work perfectly!
@jbednar do you think decimate should be exposed in hvPlot? Maybe it's just a matter of better documenting how to use HoloViews operations? I'm thinking that hvPlot should have a HoloViews user guide that explains some of the basic concepts and describes these more advanced usages.
I think hvPlot should refer to some carefully delineated sets of objects in other libraries. E.g. from Panel, it should show a few example widgets, then point to the Panel docs covering widgets with a very clear statement that any such widget would work. Same for things from HoloViews; use any HoloViews Annotation (HLine, etc.), again with a very clear statement and pointing to clear docs covering only that category, so that hvPlot users don't get lost in hv's extensive documentation. Similarly for operations and other very specific hv object types.
Whether to also mirror those objects into hvplot's namespace is a different issue. It's convenient, to avoid an import, and to make it clear that these are meant to be used with hvplot, but may also be confusing because people may wonder if there is a difference (e.g. as there is between hvplot.bind and panel.bind). So we'll need to decide that in each case. But definitely drawing a box around a set of hv and Panel things to "promote" in hvplot is a good idea.
I think hvPlot should refer to some carefully delineated sets of objects in other libraries
👍
I understand that you don't think decimate should be added as a new key word to the .hvplot API. I agree with that too, let's show some examples in hvPlot and link to sections of HoloViews docs.
Yeah, that's a slippery slope. We already have the rasterize and datashade keywords for operations, why not also decimate? It just gets crazy, because decimate takes arguments, and we're also looking at other types of decimation to support, and all those different arguments get thrown into the .hvplot argument list, which becomes impenetrable. Each new one is just one little bit more, so it's tempting!
At the hvPlot level this issue requires documenting usage of the decimate operation.