holoviews icon indicating copy to clipboard operation
holoviews copied to clipboard

Datashade prevents framewise normalization

Open LaurensvanG opened this issue 4 years ago • 7 comments

ALL software version info

holoviews: 1.14.1 bokeh: 2.2.3

Description of expected behavior and the observed behavior

Expected behavior I would expect the axes of the plot to update for every frame, even when a plot is datashaded.

Current behavior The axes do not update when a plot is datashaded. Notably, the exact same code below does work correctly if the datashade line is commented out.

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

import numpy as np
import holoviews as hv
from holoviews.operation.datashader import datashade

hv.extension("bokeh")

x = [np.random.normal(loc=m, size=10_000) for m in [0, 1]]
y = np.random.normal(size=10_000)

plots = {c: hv.Scatter(zip(x[c], y)) for c in [0, 1]}

datashade(
hv.HoloMap(plots, kdims=["Component"]).opts(framewise=True, axiswise=True)
)

Screenshots or screencasts of the bug in action

GaZj3lsR4H

N.B.: Possible duplicate of #4396, but I wasn't sure if it was the exact same. In any case this seemed like a more general version of the problem if it is indeed the same

LaurensvanG avatar Feb 02 '21 10:02 LaurensvanG

Can you try this with rasterize? It is possible that normalization isn't working as there is no way to properly normalize RGB elements together (which is what datashade returns). In recent versions of HoloViews, rasterize is better than datashade in every way as you can now apply histogram equalization colormapping client side (unless you are working with categoricals in which case you still need datashade).

jlstevens avatar Feb 03 '21 14:02 jlstevens

Sorry for not getting back to you earlier. I also could not get the axes to update appropriately using rasterize, I'm afraid.

LaurensvanG avatar Feb 19 '21 09:02 LaurensvanG

@jlstevens , here the issue is about the x axis not doing framewise normalization, not the Z axis. Without datashade each frame has a different x-axis range. With datashade they both share the same x-axis range. I can't think of a reason why that would be true; seems like a bug somewhere.

jbednar avatar Feb 21 '21 01:02 jbednar

The reason I thought the difference between RGB and Image might matter is not because of vdim normalization but because you can't normalize the RGB vdims that maybe the kdims (i.e xaxis) might also have been disabled. At any rate this is definitely a bug!

I'll assign it to 1.14.2 but @philippjfr feel free to bump it to 1.14.x if you think the fix is too involved to tackle right now.

jlstevens avatar Feb 22 '21 16:02 jlstevens

This was previously fixed but all the fixes we introduced caused other regressions. I'll dig up the relevant issues/PRs when I get a chance.

philippjfr avatar Feb 22 '21 17:02 philippjfr

Hello! Is there a "Force redraw" work around or other similar way around this? I am new to holoviews and using a dynamic map with a datashade; when I choose a new dynamic map item, the yaxis is not updated. I would be happy to simply redraw the whole view but I am not sure how to initiate this.

bbradbury avatar May 21 '22 03:05 bbradbury

@bbradbury I think you should be able to use a panel HoloViews pane to display the dynamicmap and force an update by setting the object parameter when you need it to redraw. Hope that points you in the right direction!

jlstevens avatar May 23 '22 14:05 jlstevens