Panel does not update hv.Image alpha when using .grid() and dynamic maps
See original GitHub issueHi 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)
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:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue is now fixed.
Thanks for this, looks like something happens during the overlay operation.