holoviews icon indicating copy to clipboard operation
holoviews copied to clipboard

Linked axis range update driven by framewise DynamicMap should consider data range of all linked plots

Open TheoMathurin opened this issue 1 year ago • 12 comments

ALL software version info

Software Version Info
holoviews 1.20.1

Description of expected behavior and the observed behavior

On first render, by default plots with a linked axis get their axis range based on the overall range found in the data across all plots.

In my use case, all plots may be DynamicMaps but for the sake of simplicity, let's say one of these plots is a DynamicMap with framewise=True, which means its axis range may change.

Currently, the linked axis range will be updated to fit the data range of the current DynamicMap value, ignoring the data in other plots. These other plots will therefore update to the range of the DynamicMap even if it's completely inadequate.

I'm not sure if this should be considered a bug or a design choice associated with framewise=True. The fact that on first render all the data is taken into account leads me to think it's the former.

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

import holoviews as hv
import numpy as np

hv.extension("bokeh")


def dmap_callable(scale):
    return hv.Curve(scale * np.ones(10)).opts(width=400, height=400, framewise=True)


dmap = hv.DynamicMap(dmap_callable, kdims=["scale"]).redim.range(scale=(-5, 5))
plot = hv.Curve(np.zeros(10)).opts(width=400, height=400)

plot + dmap

Screenshots or screencasts of the bug in action

Image

I feel like axis range handling is inherently complex, I hope the behaviour I'm looking for is achievable with minimal effort.

TheoMathurin avatar Feb 25 '25 16:02 TheoMathurin

I'm not completely sure I follow, but you screencast does not behave the same way for me:

https://github.com/user-attachments/assets/540e9376-1d07-4170-9845-2240a618e502

hoxbro avatar Feb 25 '25 17:02 hoxbro

Ok this behaviour is much better! But I don't know what causes the difference.

I have to say I'm actually running it in a Panel server (version 1.6.1, bokeh 3.6.3). I use python 3.12 and it's running on ubuntu.

TheoMathurin avatar Feb 25 '25 17:02 TheoMathurin

Mine was in a notebook. And on dev releases (though I don't think this should matter).

Can you run hv.show_versions()?

hoxbro avatar Feb 25 '25 18:02 hoxbro

Sure!

It's the result of a simple pip install holoviews in a python:3.12-slim container.

Python              :  3.12.9 (main, Feb 25 2025, 02:40:13) [GCC 12.2.0]
Operating system    :  Linux-6.8.0-53-generic-x86_64-with-glibc2.36
Panel comms         :  default

holoviews           :  1.20.1

bokeh               :  3.6.3
colorcet            :  3.1.0
cudf                :  -
cupy                :  -
dask                :  -
dask-expr           :  -
datashader          :  -
geoviews            :  -
hvplot              :  -
ibis-framework      :  -
IPython             :  -
ipywidgets-bokeh    :  -
jupyter-bokeh       :  -
jupyterlab          :  -
matplotlib          :  -
networkx            :  -
notebook            :  -
numba               :  -
numpy               :  2.2.3
pandas              :  2.2.3
panel               :  1.6.1
param               :  2.2.0
pillow              :  11.1.0
plotly              :  -
pyarrow             :  -
pyviz-comms         :  3.0.4
scikit-image        :  -
scipy               :  -
spatialpandas       :  -
streamz             :  -
tsdownsample        :  -
xarray              :  -

TheoMathurin avatar Feb 26 '25 07:02 TheoMathurin

I can't recreate in a simple environment, both with panel serve and in a notebook. Are you running your code locally?

Python              :  3.12.9 | packaged by conda-forge | (main, Mar  4 2025, 22:48:41) [GCC 13.3.0]
Operating system    :  Linux-6.13.5-arch1-1-x86_64-with-glibc2.41
Panel comms         :  default

holoviews           :  1.20.1

bokeh               :  3.6.3
colorcet            :  3.1.0
cudf                :  -
cupy                :  -
dask                :  -
dask-expr           :  -
datashader          :  -
geoviews            :  -
hvplot              :  -
ibis-framework      :  -
IPython             :  -
ipywidgets-bokeh    :  -
jupyter-bokeh       :  -
jupyterlab          :  -
matplotlib          :  3.10.1
networkx            :  -
notebook            :  -
numba               :  -
numpy               :  2.2.3
pandas              :  2.2.3
panel               :  1.6.1
param               :  2.2.0
pillow              :  11.1.0
plotly              :  -
pyarrow             :  -
pyviz-comms         :  3.0.4
scikit-image        :  -
scipy               :  -
spatialpandas       :  -
streamz             :  -
tsdownsample        :  -
xarray              :  -

hoxbro avatar Mar 13 '25 11:03 hoxbro

Yes this is running on my laptop.

I'll ask others to see if they can replicate.

TheoMathurin avatar Mar 20 '25 21:03 TheoMathurin

A colleague also observed this behaviour on holoviews 1.20.1 and panel 1.6.1.

TheoMathurin avatar Mar 21 '25 08:03 TheoMathurin

What browser are you using?

Your code in the first post does not look correct, as it is missing some panel code to be able to serve it.

hoxbro avatar Mar 24 '25 18:03 hoxbro

I get the same output in Firefox and Chromium.

As for the code, I put the plots in a panel row container and serve it: pn.Row(plot, dmap).servable(). I did not include the panel code in the MRE since I figured it was a holoviews issue but you're right that it matters.

TheoMathurin avatar Mar 25 '25 07:03 TheoMathurin

Can you try pn.panel(plot + dmap).servable()

hoxbro avatar Mar 25 '25 07:03 hoxbro

That's it, well done!

However I would expect the plots in a pn.Row to behave the same way.

TheoMathurin avatar Mar 25 '25 07:03 TheoMathurin

However I would expect the plots in a pn.Row to behave the same way.

I would, too, but at least I can recreate the problem.

@philippjfr, should I move this to the panel issue tracker?

hoxbro avatar Mar 25 '25 07:03 hoxbro