holoviz / holoviews

With Holoviews, your data visualizes itself.
https://holoviews.org
BSD 3-Clause "New" or "Revised" License
2.69k stars 402 forks source link

Hover info for holoviews.image is tracking non-inverted array values when 'invert_yaxis=True' #5859

Closed GeoVizNow closed 5 months ago

GeoVizNow commented 1 year ago

I wanted to report an issue just seen when applying 'invert_yaxis=True' to a holoviews image the hover info is tracking wrong (non-inverted) values.

ALL software version info

os: Windows 10 ide: jupyter numpy: 1.23.5 bokeh: 3.2.1 holoviews: 1.17.0

Description of expected behavior and the observed behavior

When applying 'invert_yaxis=True' I expect the hover tracking image values to track the inverted image values. This does currently not seem to be the case.

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

import numpy as np
import bokeh
import holoviews as hv
from holoviews import opts
hv.extension('bokeh')

arr = np.ones((10, 4))
arr[2:6,1:4] = np.nan
arr[6:10,:] = 2
arr 

i = hv.Image(arr)
i.opts(tools=['hover'], invert_yaxis=True, colorbar=True, cmap=['gray', 'blue'])

Screenshots or screencasts of the bug in action

image

GeoVizNow commented 1 year ago

I would be happy to try to make a test to try to ensure this use case is working, but am not sure how to best do that. Maybe try materialize the image value from a hover location(?). Any tips to how such a test is best structured?

hoxbro commented 1 year ago

Related to Bokeh 3 as this works with Bokeh 2. image

I would expect some changes to be needed in similar places as https://github.com/holoviz/holoviews/pull/5796.

hoxbro commented 1 year ago

@mattpap, can you check if this is a Bokeh issue?

GeoVizNow commented 12 months ago

Was this a problem on the bokeh side?

thomasteisberg commented 6 months ago

This seems to also impact quadmesh as well when rasterize=True:

import numpy as np
import xarray as xr
import hvplot.xarray

test = xr.DataArray(np.random.randint(0,3,size=(10,10)), dims=['x', 'y'])

p = test.hvplot.quadmesh(ylim=(9, 0), rasterize=True)
p

Screenshot from 2024-03-22 16-35-59

Fresh install in a test environment:

$ mamba list | grep "bokeh\|hvplot\|xarray\|datashader\|dask"
bokeh                     3.3.4              pyhd8ed1ab_0    conda-forge
dask                      2024.3.1           pyhd8ed1ab_0    conda-forge
dask-core                 2024.3.1           pyhd8ed1ab_0    conda-forge
dask-expr                 1.0.4              pyhd8ed1ab_0    conda-forge
datashader                0.16.0             pyhd8ed1ab_0    conda-forge
hvplot                    0.9.2              pyhd8ed1ab_0    conda-forge
jupyter_bokeh             4.0.1              pyhd8ed1ab_0    conda-forge
xarray                    2024.2.0           pyhd8ed1ab_0    conda-forge
hoxbro commented 5 months ago

Try upgrading to Bokeh 3.4. This has fixed it for me.

image image