Get Widget for selecting dimension in Dynamic Map

Hi, I Have a DynamicMap object like this:

print(MH)
:DynamicMap   [time]
   :Overlay
      .Image.I     :Image   [lon,lat]   (temp2)
      .Coastline.I :Feature   [Longitude,Latitude]

If I just output this to the notebook,I get a nice drop down menu to select the time with. I’d like to use this object in Panel. How do I get a handle for the dimension selector to put it somewhere in my GridSpec?

Thanks!
Paul

When working with any object in Panel it is usually easiest to start by using the pn.panel function on it and inspect the output:

hv_panel = pn.panel(dmap)
print(hv_panel)
Row
    [0] HoloViews(DynamicMap)
    [1] Column
        [0] WidgetBox
            [0] IntSlider(end=100, margin=(20, 20, 20, 20), name='time', start=10, value=10, width=250)
        [1] VSpacer()

Now that we know what the components look like we can index into this object and lay it out as we need, e.g.

pn.Row(hv_panel[0], hv_panel[1][0])
1 Like

That seems to have done the trick; I can now lay out the parts of my plot where I want. However, it seems as if the DynamicMap is no longer reacting to changes in the selection…

Never encountered this, do you have a reproducible example you could file as an issue?

For example this basic example works fine for me:

dmap = hv.DynamicMap(lambda x: hv.Curve([1, 2, x]), kdims=['time']).redim.range(time=(10, 100))

hv_panel = pn.panel(dmap)

pn.Row(hv_panel[0], hv_panel[1][0])