holoviz / holoviews

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

Quadmesh redim.step does not work #5173

Open robin-cls opened 2 years ago

robin-cls commented 2 years ago

I am trying to subsample an irregular grid using QuadMesh in holoview 1.14.6, but it appears redim.step is not taken into account when plotting

import numpy as np
import holoviews as hv

x = np.arange(100)
y = np.arange(100)
z = np.random.random(10000).reshape((100, 100))

hv.QuadMesh((x, y, z)).redim.step(x=10)

image

I was expecting a plot with the x axis decimated, similar to a QuadMesh receiving already subsampled data

hv.QuadMesh((x[::10], y, z[:, ::10]))

image

I am quite new to holoviews so maybe I missed something on how redim.step is supposed to work. Any idea if this is actually a bug ?

philippjfr commented 2 years ago

Seems like a neat idea but we never envisioned the step attribute applying to elements (even though it makes perfect sense and would be consistent). The step attribute currently exists solely to express step size when declaring the parameter space of a DynamicMap. Seems to me like this should either warn or we should consider implementing what you suggest (where it makes sense).

robin-cls commented 2 years ago

Thanks for your answer philippjfr, is there a part in the documentation that tells us more about the different attributes of redim and where we can use them ?

jbednar commented 2 years ago

That's definitely a useful extension to consider; it's a natural way to express resampling! For now you can use holoviews.operation.rasterize to do resampling like that.

robin-cls commented 2 years ago

Thanks for your answer, I checked rasterize and it works well, although I need some tuning to get the proper amount of interactivity on an irregular grid