Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lasso select does not work on datashaded NdOverlay #5041

Open
peterroelants opened this issue Jul 23, 2021 · 1 comment
Open

Lasso select does not work on datashaded NdOverlay #5041

peterroelants opened this issue Jul 23, 2021 · 1 comment
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@peterroelants
Copy link
Contributor

Description of expected behavior and the observed behavior

Using the lasso selection tool on a NdOverlay that is datashade-ed does not work and results in the following message being printed:

linked_selection aborted because it could not display selection for all elements: ufunc 'invert' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''.

Complete, minimal, self-contained example code that reproduces the issue

This code

import numpy as np
import holoviews as hv
import datashader
from holoviews.operation.datashader import datashade, shade, dynspread, spread, rasterize

hv.extension('bokeh')

points_dct = {
    'p1': hv.Points(np.random.randn(10000, 2), kdims=['x', 'y'], label='p1'),
    'p2': hv.Points(np.random.randn(10000, 2) * 2 + 1, kdims=['x', 'y'], label='p2')
}
nd_overlay = hv.NdOverlay(points_dct, kdims=['cat'])
nd_overlay_shaded = spread(
    datashade(
        nd_overlay, 
        aggregator=datashader.by('cat', datashader.count()), cnorm="eq_hist")
    , px=1
)
hv.selection.link_selections(nd_overlay_shaded)

And using the lasso selection results in:
lasso select not working

Please note that the box selection works, as well as the lasso-select on a datashaded plot that consists of just points (no NdOverlay.

ALL software version info

Python implementation: CPython
Python version       : 3.9.6
IPython version      : 7.25.0

Compiler    : GCC 9.3.0
OS          : Linux
Release     : 5.10.0-1038-oem
Machine     : x86_64
Processor   : x86_64
CPU cores   : 16
Architecture: 64bit

numpy     : 1.21.1
bokeh     : 2.3.3
datashader: 0.13.0
holoviews : 1.14.5

jupyter core     : 4.7.1
jupyter-notebook : 6.4.0
qtconsole        : not installed
ipython          : 7.25.0
ipykernel        : 6.0.3
jupyter client   : 6.1.12
jupyter lab      : 3.0.16
nbconvert        : 6.1.0
ipywidgets       : 7.6.3
nbformat         : 5.1.3
traitlets        : 5.0.5
@jlstevens
Copy link
Contributor

jlstevens commented Aug 9, 2021

Thanks for reporting this!

I can confirm the problem with your minimal example. I think the issue is not directly due to it being an NdOverlay but due to datashade being necessary which returns RGB images (unlike rasterize). Regardless, linked_selections should be able to support this case so I'll mark this as a bug.

@jlstevens jlstevens added the type: bug Something isn't correct or isn't working label Aug 9, 2021
@jlstevens jlstevens added this to the v2.0 milestone Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

2 participants