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

y_range.tags expected to be a dictionary, but it's a list #5849

Closed
droumis opened this issue Aug 8, 2023 · 1 comment · Fixed by #5851
Closed

y_range.tags expected to be a dictionary, but it's a list #5849

droumis opened this issue Aug 8, 2023 · 1 comment · Fixed by #5851
Labels
type: bug Something isn't correct or isn't working

Comments

@droumis
Copy link
Member

droumis commented Aug 8, 2023

Thanks for contacting us! Please read and follow these instructions carefully, then delete this introductory text to keep your issue easy to read. Note that the issue tracker is NOT the place for usage questions and technical assistance; post those at Discourse instead. Issues without the required information below may be closed immediately.

ALL software version info

versions:
Python              :  3.9.16 | packaged by conda-forge | (main, Feb  1 2023, 21:38:11) 
[Clang 14.0.6 ]
Operating system    :  macOS-13.4.1-arm64-arm-64bit
holoviews           :  1.17.0

bokeh               :  3.2.1
colorcet            :  3.0.1
cudf                :  -
dask                :  2023.7.1
datashader          :  0.15.1
geoviews            :  -
hvplot              :  0.8.4
ibis                :  -
IPython             :  8.14.0
jupyter_bokeh       :  3.0.7
jupyterlab          :  3.5.3
matplotlib          :  3.7.2
networkx            :  3.1
notebook            :  6.5.4
numba               :  0.57.1
numpy               :  1.24.4
pandas              :  2.0.3
panel               :  1.2.1
param               :  1.13.0
PIL                 :  10.0.0
plotly              :  -
pyarrow             :  12.0.1
scipy               :  1.11.1
skimage             :  0.21.0
spatialpandas       :  -
streamz             :  -
xarray              :  2023.7.0

Description of expected behavior and the observed behavior

Player widget should be controlling the playback of several plots arranged in a layout, but as soon as the "right" plot is added, the traceback occurs.

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

import panel as pn
import numpy as np
import xarray as xr
import hvplot.xarray
import holoviews as hv

data_values = np.random.rand(10, 20, 20)
frame_coords = np.arange(10)
height_coords = np.linspace(0, 1, 20)
width_coords = np.linspace(0, 1, 20)

data = xr.DataArray(
    data_values,
    dims=["frame", "height", "width"],
    coords={"frame": frame_coords, "height": height_coords, "width": width_coords}
)

fs = 30  # frames per second
video_player = pn.widgets.Player(
    length=len(data.coords["frame"]),
    interval=1000 // fs,  # ms per frame
    value=0,
    max_width=400,
    max_height=90,
    loop_policy="loop",
    sizing_mode="stretch_width",
)

main = data.hvplot.image(
    groupby="frame",
    cmap="Viridis",
    frame_height=400,
    frame_width=400,
    colorbar=False,
    widgets={"frame": video_player},
)

def update_vline(value):
    return hv.VLine(value)

def update_hline(value):
    return hv.HLine(value)

dmap_vline = hv.DynamicMap(update_vline, streams=[video_player.param.value]).opts(color='red', alpha=.6, line_width=3)
dmap_hline = hv.DynamicMap(update_hline, streams=[video_player.param.value]).opts(color='red', alpha=.6, line_width=3)

right = data.mean(['width']).hvplot.image(x='frame',
    cmap="Viridis",
    frame_height=400,
    frame_width=100,
    colorbar=False,
    title='_',
) * dmap_hline

bottom = data.mean(['height']).hvplot.image(y='frame',
    cmap="Viridis",
    frame_height=100,
    frame_width=400,
    colorbar=False,
) * dmap_vline
 
pn.Column(video_player, pn.Row(main[0], right), bottom)

Stack traceback and/or browser JavaScript console output

Traceback (most recent call last):
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/pyviz_comms/__init__.py", line 340, in _handle_msg
    self._on_msg(msg)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/panel/viewable.py", line 471, in _on_msg
    doc.unhold()
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/bokeh/document/document.py", line 776, in unhold
    self.callbacks.unhold()
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/bokeh/document/callbacks.py", line 431, in unhold
    self.trigger_on_change(event)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/bokeh/document/callbacks.py", line 408, in trigger_on_change
    invoke_with_curdoc(doc, event.callback_invoker)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/bokeh/document/callbacks.py", line 443, in invoke_with_curdoc
    return f()
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/bokeh/util/callback_manager.py", line 185, in invoke
    callback(attr, old, new)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/panel/reactive.py", line 469, in _comm_change
    state._handle_exception(e)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/panel/io/state.py", line 436, in _handle_exception
    raise exception
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/panel/reactive.py", line 467, in _comm_change
    self._schedule_change(doc, comm)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/panel/reactive.py", line 449, in _schedule_change
    self._change_event(doc)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/panel/reactive.py", line 445, in _change_event
    self._process_events(events)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/panel/reactive.py", line 384, in _process_events
    self.param.update(**self_events)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/param/parameterized.py", line 1902, in update
    self_._batch_call_watchers()
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/param/parameterized.py", line 2063, in _batch_call_watchers
    self_._execute_watcher(watcher, events)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/param/parameterized.py", line 2025, in _execute_watcher
    watcher.fn(*args, **kwargs)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/holoviews/streams.py", line 760, in _watcher
    self.trigger([self])
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/holoviews/streams.py", line 186, in trigger
    subscriber(**dict(union))
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 232, in refresh
    raise e
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 228, in refresh
    self._trigger_refresh(stream_key)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 245, in _trigger_refresh
    self.update(key)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 944, in update
    item = self.__getitem__(key)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/holoviews/plotting/plot.py", line 431, in __getitem__
    self.update_frame(frame)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/holoviews/plotting/bokeh/element.py", line 2836, in update_frame
    self._update_ranges(element, ranges)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/holoviews/plotting/bokeh/element.py", line 952, in _update_ranges
    self._update_main_ranges(element, x_range, y_range, ranges)
  File "/Users/droumis/opt/miniconda3/envs/neuro-video-viewer/lib/python3.9/site-packages/holoviews/plotting/bokeh/element.py", line 1115, in _update_main_ranges
    y_range.tags[1]['invert_yaxis'] if y_range.tags else False,
TypeError: list indices must be integers or slices, not str

Screenshots or screencasts of the bug in action

image

@droumis droumis added the TRIAGE Needs triaging label Aug 8, 2023
@droumis droumis moved this to Todo in CZI R5 neuro Aug 8, 2023
@hoxbro hoxbro added type: bug Something isn't correct or isn't working and removed TRIAGE Needs triaging labels Aug 8, 2023
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants