Skip to content

DynamicMap is not updated when embedded in dynamic Tabs #2865

@pat-schmitt

Description

@pat-schmitt

It seems like holoviews DynamicMap is not updated when embedded in panel Tabs when dynamic is set to True.

See example below with two videos (first with dynamic=False, second with dynamic=True). Only with dynamic=False the figure is updated as expected.

I am not sure if it is a holoviews or a panel problem.

ALL software version info

panel=0.12.4
holoviews=1.14.6
bokeh=2.4.0

Complete, minimal, self-contained example code that reproduces the issue (with dynamic=True)

import numpy as np
import holoviews as hv
from holoviews import opts
from holoviews.streams import Stream, param
import panel as pn

hv.extension('bokeh')
pn.extension()

lin = np.linspace(-np.pi,np.pi,300)

def lissajous(t, a=3, b=5, delta=np.pi/2.):
    return (np.sin(a * t + delta), np.sin(b * t))

def lissajous_crosshair(t, a=3, b=5, delta=np.pi/2):
    (x,y) = lissajous(t,a,b,delta)
    return hv.VLine(x) * hv.HLine(y)

path = hv.Path(lissajous(lin))

Time = Stream.define('Time', t=param.Number(default=0.0, doc='A time parameter'))
time = Time(t=np.pi/4)
dmap = hv.DynamicMap(lissajous_crosshair, streams=[time])

def button_click(event):
    dmap.event(t=button.clicks)

button = pn.widgets.Button(name='change dmap')
button.on_click(button_click)

app = pn.Tabs(('Plot', path * dmap),
              ('Button', button),
              dynamic=True)

app.show()

Video with dynamic=False

dynamic_false.mp4

Video with dynamic=True

dynamic_true.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions