Panel can be used to make a first pass at an app or dashboard in minutes, while also allowing you to fully customize the app’s behavior and appearance or flexibly integrate GUI support into long-term, large-scale software projects. To accommodate these different ways of using Panel, four different APIs are available:
Interact functions: Auto-generates a full UI (including widgets) given a function
Reactive functions: Linking functions or methods to widgets using
pn.bindor the equivalent
pn.dependsdecorator, declaring that the function should be re-run when those widget values change
Parameterized class: Declare parameters and their ranges in Parameterized classes, then get GUIs (and value checking!) for free
Callbacks: Generate a UI by manually declaring callbacks that update panels or panes
Each of these APIs has its own benefits and drawbacks, so this section will go through each one in turn, while working through an example app and pointing out the benefits and drawback along the way. For a quick overview you can also review the API gallery examples, e.g. the stocks_hvplot app.
To start with let us define some imports, load the
autompg dataset, and define a plotting function we will be reusing throughout this user guide.
import hvplot.pandas from bokeh.sampledata.autompg import autompg def autompg_plot(x='mpg', y='hp', color='#058805'): return autompg.hvplot.scatter(x, y, c=color, padding=0.1) columns = list(autompg.columns[:-2])