question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Panel does not update hv.Image alpha when using .grid() and dynamic maps

See original GitHub issue

Hi All,

I’m using holoviews 1.12.5 and panel 0.6.2 on linux to produce this bug.

When using a panel slider widget to change the alpha of an overlay image, the active image does not change alpha if it is a dynamic map within a GridSpace. If the images are not dynamic, or are not using .grid(), the slider acts as expected. Here is a code segment that should reproduce this issue:

import xarray as xr
import holoviews as hv
import panel as pn
hv.extension('bokeh')

image = np.random.randint(0, 256, size=(2,3,10,100,100))
mask = np.random.randint(0, 256, size=(2,3,10,100,100))

# make xarray dataset to hold images
ds = xr.Dataset({'image':(['subject', 'sequence', 'z', 'x', 'y'], image),
                 'mask':(['subject', 'sequence', 'z', 'x', 'y'], mask)},
                coords={'subject': ['a', 'b'],
                       'sequence': ['1', '2', '3'],
                       'x': list(range(100)),
                       'y': list(range(100)),
                       'z': list(range(10))}
               )

# make slider
slider = pn.widgets.FloatSlider(start=0, end=1, value=0.5, name='mask_slider')

# make hv datasets and images
hv_ds = hv.Dataset(ds)
hv_ds_image = hv_ds.to(hv.Image, kdims=['x', 'y'], vdims='image', dynamic=True).opts(cmap='Blues')
hv_ds_mask= hv_ds.to(hv.Image, kdims=['x', 'y'], vdims='mask', dynamic=True).opts(cmap='Reds').apply.opts(alpha=slider.param.value)

# make grid on 'sequence' coord, implicit groupby for 'z' and 'subject'
grid = (hv_ds_image*hv_ds_mask).grid('sequence')

#return the panel Column
pn.Column(slider, grid)

image

Changing the slider does not affect the current active images, but will affect any images that have not yet been viewed. Once they are viewed, they are “locked in” to that value of alpha and will no longer change.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
philippjfrcommented, Oct 2, 2019

The issue is now fixed.

1reaction
philippjfrcommented, Oct 1, 2019

Thanks for this, looks like something happens during the overlay operation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Live Data — HoloViews v1.15.3
The HoloMap is a core HoloViews data structure that allows easy exploration of ... ys = np.meshgrid(xvals, yvals) def waves_image(alpha, beta): return hv....
Read more >
pyviz/pyviz - Gitter
Hi All, i've been using holoviews and the pyviz ecosystem for about a half ... as long as dynamic=True is set for hv_ds_image...
Read more >
How do I delete my selected point dynamically from other ...
I am trying to create a dynamic widget that links a data frame and a map using Datalinks. The user can select points...
Read more >
Update Holoviews Image interactively with Panel widget
So you seem to have misunderstood the model for updating HoloViews plots a little bit. HoloViews elements should not be modified inplace, ...
Read more >
Lesson 24: Dashboards — Programming Bootcamp ...
(Note that I did not set the HoloViews defaults in using bootcamp_utils ... We can use Panel to create interactive sliders using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found