Skip to content Skip to sidebar Skip to footer

What Is The Best Way To Change The Widget Type In An Hvplot/holoviews/panel Object?

Using the functionality in pyviz, it's easy to generate an hvplot/panel interactive dashboard for a gridded xarray dataset, like this air temperature data example: import xarray as

Solution 1:

To understand how to customize the display output of different types you have to understand how panel transform the objects that you give it into the objects that you see when displaying the pprint output. Specifically, internally panel will call the pn.panel function which tries to find the most appropriate Pane object to render what you gave it. In this case that is the HoloViews pane which is responsible for generating the widgets and for rendering the actual plot. In other words this code:

row = pn.Row(mesh)

is actually equivalent to:

row = pn.Row(pn.panel(mesh))

which in turn is equivalent to:

row = pn.Row(pn.holoviews.HoloViews(mesh).layout)

Once you are at the level of the actual Pane used to render the object you will be able to see the parameters available to customize the visual representation of the object. In the case of the HoloViews pane it offers a widgets parameter which allows supplying widget classes or instances as overrides for each of the dimensions in the object you are displaying. In your case you therefore want to do something like this:

pn.holoviews.HoloViews(mesh, widgets={'time': pn.widgets.Select}).layout

or less explicitly:

pn.panel(mesh, widgets={'time': pn.widgets.Select})

select_widget

Post a Comment for "What Is The Best Way To Change The Widget Type In An Hvplot/holoviews/panel Object?"