12 Parameters and Widgets ¶
In previous sections we have mostly been learning about using HoloViews to build visualizations. There is only so much information that can be packed on to the screen at once, and in practice it's often necessary to supply interactive widgets so the user can further select what is shown. HoloViews can provide widgets automatically for dimensions that have been declared on the data, but often you will want to express other types of user-settable parameters to control your plots. Here we will discover how to leverage the Panel layout/widget/app/dashboard/web-ui library, along with the Param library to declare your own custom parameters in a GUI-independent way. Param and Panel both work with nearly any plotting library, not just HoloViews, but we'll mainly focus on HoloViews examples because those should be familiar by now and because they make it simple to express even quite complex interactive behavior.
import param, panel as pn, numpy as np, holoviews as hv from bokeh.document import Document hv.extension('bokeh')