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

Interactivity error with datashade=True option, image moving opposite to cursor displacement #739

Closed
hxawax opened this issue Apr 14, 2022 · 2 comments
Labels
type: bug Something isn't working
Milestone

Comments

@hxawax
Copy link

hxawax commented Apr 14, 2022

Hello,
I'm reporting a bug on the interactive side of hvplot with the option datashade=True.

ALL software version info

hvplot version : 0.7.3
xarray version 2022.3.0
datashader version 0.13.0
bokeh version 2.4.2

Description of expected behavior and the observed behavior

The expected behavior is to zoom in and out in an image at the cursor location, move the image according to the cursor movement.
The expected behavior is to box zoom at the location of your box.
The observed behavior is to move image in the opposite direction of cursor movement, box zoom out of the expected box.

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

Viewing a heavy image using 'datashade=True' option, the interactivity feels broken.

xr.open_dataset('bug2.nc').band_data.hvplot(datashade=True,)

capture-2znp9svr_g3mETs6K.mp4

when I click and move the cursor to the right ( X pixels to the right) the image first follow the cursor movement but at soon as I release the mouse click the image reload and appear to have displaced of -X to the left.
The opposite is occurring for a click and move to the left, the image reload with a movement to the right
The same bug is affecting the box zoom with a zoom out of the selected box.

when using datashade=False every thing is working as expected.

@maximlt maximlt added the type: bug Something isn't working label May 3, 2022
@maximlt maximlt added this to the 0.8.1 milestone May 3, 2022
@maximlt
Copy link
Member

maximlt commented May 3, 2022

This issue can be reproduced with the following snippet. The issue arises because the coordinates are descending, there's no issue when they're ascending. If only one dimension is ascending, the issue only happens in its direction. The issue doesn't appear with rasterize=True instead of datashade=True.

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

da = xr.DataArray(
    data=np.random.rand(1000, 1000),
    dims=['x', 'y'],
    coords={'x': np.arange(1000, 0, -1), 'y': np.arange(1000, 0, -1)}
)

da.hvplot(x='x', y='y', datashade=True)

issue_hvplot_descending_coordinates

I suspect this is related to holoviz/datashader#1054

@maximlt
Copy link
Member

maximlt commented Jun 24, 2022

I am very happy to report that this issue has been fixed upstream in datashader by holoviz/datashader#1095

To get the fix in your environment you will need to install datashader>=1.14.1

@maximlt maximlt closed this as completed Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants