# Introduction¶

Panel lets you add interactive controls for just about anything you can display in Python. Panel can help you build simple interactive apps, complex multi-page dashboards, or anything in between. As a simple example, let's say you have created a function to plot a sine wave using Matplotlib and the Pandas .plot() command:

In [1]:
import numpy as np, pandas as pd, matplotlib.pyplot as plt
%matplotlib inline

def mplplot(df, **kwargs):
fig = df.plot().get_figure()
plt.close(fig)
return fig

def sine(frequency=1.0, amplitude=1.0, n=200, view_fn=mplplot):
xs = np.arange(n)/n*20.0
ys = amplitude*np.sin(frequency*xs)
df = pd.DataFrame(dict(y=ys), index=xs)
return view_fn(df, frequency=frequency, amplitude=amplitude, n=n)

sine(1.5, 2.5)

Out[1]:

If we wanted to try out lots of combinations of these values to understand how frequency and amplitude affect this plot, we could reevaluate the above cell lots of times, but that would be a slow and painful process, and is only really appropriate for users who are comfortable with editing Python code.

## Interactive Panels¶

Instead of editing code, it's much quicker and more straightforward to use sliders to adjust the values interactively. You can easily make a Panel app to explore a function's parameters using pn.interact, which is similar to the ipywidgets interact function:

In [2]:
import panel as pn
pn.extension()

pn.interact(sine)