Top Related Projects
Streamlit — A faster way to build and share data apps.
Data Apps & Dashboards for Python. No JavaScript Required.
Interactive Data Visualization in the browser, from Python
Voilà turns Jupyter notebooks into standalone web applications
Interactive Widgets for the Jupyter Notebook
Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
Quick Overview
Panel is a powerful Python library for creating interactive web apps and dashboards. It allows users to create complex layouts and interactive visualizations using a wide range of data sources and plotting libraries. Panel is designed to be flexible and easy to use, making it suitable for both beginners and experienced developers.
Pros
- Supports multiple plotting libraries (Bokeh, Matplotlib, Plotly, etc.)
- Easy to create responsive layouts with a wide range of widgets
- Seamless integration with Jupyter notebooks and other data science tools
- Highly customizable with support for custom CSS and JavaScript
Cons
- Learning curve can be steep for complex applications
- Documentation can be overwhelming for beginners
- Performance may be slower compared to some specialized visualization libraries
- Limited built-in themes and styling options
Code Examples
- Creating a simple interactive plot:
import panel as pn
import numpy as np
import holoviews as hv
pn.extension(sizing_mode="stretch_width")
@pn.depends(x=pn.widgets.FloatSlider(start=0, end=10, value=0))
def sine_curve(x):
xs = np.linspace(0, 10, 100)
return hv.Curve((xs, np.sin(xs + x))).opts(width=600)
pn.Column(sine_curve).servable()
- Creating a dashboard with multiple plots:
import panel as pn
import hvplot.pandas
import pandas as pd
pn.extension(sizing_mode="stretch_width")
df = pd.read_csv('https://raw.githubusercontent.com/holoviz/panel/main/examples/assets/occupancy.csv')
scatter = df.hvplot.scatter(x='Temperature', y='Humidity', c='Occupancy', cmap=['blue', 'red'])
hist = df.hvplot.hist('CO2', bins=20)
dashboard = pn.Column(
pn.Row(scatter, hist),
df.hvplot.table(width=900)
)
dashboard.servable()
- Creating an interactive data explorer:
import panel as pn
import pandas as pd
import hvplot.pandas
pn.extension(sizing_mode="stretch_width")
df = pd.read_csv('https://raw.githubusercontent.com/holoviz/panel/main/examples/assets/iris.csv')
x_select = pn.widgets.Select(options=list(df.columns)[:-1], value='sepal_length')
y_select = pn.widgets.Select(options=list(df.columns)[:-1], value='sepal_width')
@pn.depends(x_select, y_select)
def create_plot(x, y):
return df.hvplot.scatter(x=x, y=y, c='species', cmap='Category10', width=400, height=400)
explorer = pn.Column(
pn.Row(x_select, y_select),
create_plot
)
explorer.servable()
Getting Started
To get started with Panel, install it using pip:
pip install panel
Then, create a simple app:
import panel as pn
import numpy as np
pn.extension()
slider = pn.widgets.FloatSlider(start=0, end=10, step=0.1, value=5)
@pn.depends(slider)
def plot(value):
return pn.pane.Matplotlib(plt.plot(np.sin(np.linspace(0, value))))
pn.Column(slider, plot).servable()
Run the app using the panel serve
command:
panel serve your_app.py
Competitor Comparisons
Streamlit — A faster way to build and share data apps.
Pros of Streamlit
- Simpler, more intuitive API for rapid prototyping
- Built-in deployment platform (Streamlit Cloud)
- Larger community and ecosystem of components
Cons of Streamlit
- Less flexible layout options
- Limited interactivity without custom components
- Slower performance for complex applications
Code Comparison
Streamlit:
import streamlit as st
st.title("Hello World")
name = st.text_input("Enter your name")
st.write(f"Hello, {name}!")
Panel:
import panel as pn
pn.extension()
name = pn.widgets.TextInput(name="Enter your name")
output = pn.bind(lambda x: f"Hello, {x}!", name)
pn.Column("# Hello World", name, output).servable()
Both Panel and Streamlit are popular Python libraries for creating interactive web applications. Streamlit offers a more straightforward approach, making it ideal for quick prototypes and data science projects. Panel, on the other hand, provides greater flexibility and integration with other HoloViz tools, making it suitable for more complex dashboards and applications. The code comparison demonstrates the simplicity of Streamlit's API versus Panel's more explicit approach to defining layouts and interactions.
Data Apps & Dashboards for Python. No JavaScript Required.
Pros of Dash
- More mature ecosystem with extensive documentation and examples
- Stronger integration with Plotly's interactive plotting library
- Better support for large-scale, production-ready applications
Cons of Dash
- Steeper learning curve, especially for those new to web development
- Less flexibility in layout customization compared to Panel
- Requires more boilerplate code for simple applications
Code Comparison
Dash example:
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash(__name__)
app.layout = html.Div([
dcc.Graph(id='example-graph')
])
Panel example:
import panel as pn
import hvplot.pandas
pn.extension()
plot = df.hvplot(x='x', y='y')
pn.panel(plot).servable()
Both Dash and Panel are powerful tools for creating interactive dashboards and web applications with Python. Dash excels in complex, production-ready applications, while Panel offers a more intuitive API for rapid prototyping and simpler projects. The choice between them often depends on the specific requirements of your project and your familiarity with web development concepts.
Interactive Data Visualization in the browser, from Python
Pros of Bokeh
- More mature and established project with a larger community
- Offers lower-level control for custom visualizations
- Extensive documentation and examples
Cons of Bokeh
- Steeper learning curve for beginners
- Requires more code to create interactive dashboards
- Less integration with other data science libraries
Code Comparison
Bokeh:
from bokeh.plotting import figure, show
from bokeh.layouts import column
p1 = figure(title="Plot 1")
p1.line([1, 2, 3], [4, 5, 6])
p2 = figure(title="Plot 2")
p2.circle([1, 2, 3], [4, 5, 6])
show(column(p1, p2))
Panel:
import panel as pn
import hvplot.pandas
df = pd.DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})
plot1 = df.hvplot.line('x', 'y', title="Plot 1")
plot2 = df.hvplot.scatter('x', 'y', title="Plot 2")
pn.Column(plot1, plot2).servable()
Panel builds on top of Bokeh, providing a higher-level interface for creating interactive dashboards and applications. It offers easier integration with other libraries and requires less code for complex layouts. However, Bokeh provides more fine-grained control and is better suited for custom, low-level visualizations. Both projects have their strengths, and the choice between them depends on the specific requirements of your project and your familiarity with data visualization libraries.
Voilà turns Jupyter notebooks into standalone web applications
Pros of Voila
- Simpler setup and deployment process
- Tighter integration with Jupyter notebooks
- Lighter weight and faster initial loading times
Cons of Voila
- Less flexibility in layout and design options
- More limited interactivity and real-time updates
- Fewer built-in widgets and components
Code Comparison
Panel:
import panel as pn
def update(value):
return f"Selected value: {value}"
slider = pn.widgets.FloatSlider(start=0, end=10, step=0.1)
output = pn.bind(update, slider)
pn.Column(slider, output).servable()
Voila:
import ipywidgets as widgets
from IPython.display import display
def update(value):
output.value = f"Selected value: {value}"
slider = widgets.FloatSlider(min=0, max=10, step=0.1)
output = widgets.HTML()
widgets.interactive(update, value=slider)
display(slider, output)
Both Panel and Voila are tools for creating interactive dashboards from Jupyter notebooks, but they have different approaches and strengths. Panel offers more flexibility and advanced features for complex dashboards, while Voila provides a simpler, more streamlined experience for quickly turning notebooks into web applications.
Interactive Widgets for the Jupyter Notebook
Pros of ipywidgets
- Tighter integration with Jupyter ecosystem
- Wider adoption and community support
- More extensive widget library out-of-the-box
Cons of ipywidgets
- Limited standalone deployment options
- Less flexibility in layout and styling
- Steeper learning curve for complex applications
Code Comparison
ipywidgets:
import ipywidgets as widgets
slider = widgets.IntSlider(value=50, min=0, max=100)
output = widgets.Output()
display(slider, output)
Panel:
import panel as pn
slider = pn.widgets.IntSlider(value=50, start=0, end=100)
output = pn.pane.Markdown()
pn.Column(slider, output).servable()
Both libraries allow for interactive widget creation, but Panel offers a more streamlined approach for creating standalone applications. ipywidgets is more tightly integrated with Jupyter notebooks, while Panel provides greater flexibility for deployment across various environments. Panel's API is generally more intuitive for building complex dashboards, whereas ipywidgets may require more boilerplate code for similar functionality.
Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
Pros of Gradio
- Simpler and more intuitive API for quick prototyping
- Built-in support for machine learning and AI-specific components
- Easier deployment and sharing of demos with auto-generated public URLs
Cons of Gradio
- Less flexible for complex, custom layouts and designs
- More limited set of widgets and components compared to Panel
- Primarily focused on ML/AI applications, less suitable for general-purpose dashboards
Code Comparison
Panel:
import panel as pn
pn.extension()
slider = pn.widgets.FloatSlider(start=0, end=10, step=0.1)
text = pn.widgets.StaticText()
def update(value):
text.value = f"Value: {value}"
slider.param.watch(update, 'value')
pn.Column(slider, text).servable()
Gradio:
import gradio as gr
def update(value):
return f"Value: {value}"
gr.Interface(
fn=update,
inputs=gr.Slider(0, 10, step=0.1),
outputs="text"
).launch()
Both Panel and Gradio are powerful tools for creating interactive web applications, with Panel offering more flexibility and customization options, while Gradio excels in simplicity and ease of use, especially for machine learning and AI-related projects.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Panel: The powerful data exploration & web app framework for Python
Panel is an open-source Python library that lets you easily build powerful tools, dashboards and complex applications entirely in Python. It has a batteries-included philosophy, putting the PyData ecosystem, powerful data tables and much more at your fingertips. High-level reactive APIs and lower-level callback based APIs ensure you can quickly build exploratory applications, but you aren't limited if you build complex, multi-page apps with rich interactivity. Panel is a member of the HoloViz ecosystem, your gateway into a connected ecosystem of data exploration tools.
Enjoying Panel? Show your support with a Github star â itâs a simple click that means the world to us and helps others discover it too! âï¸
Downloads | |
Build Status | |
Coverage | |
Latest dev release | |
Latest release | |
Docs | |
Notebooks | |
Support |
Home | Installation instructions | Getting Started Guide | Reference Guides | Examples | License | Support
Panel works with the tools you know and love
Panel makes it easy to combine widgets, plots, tables and other viewable Python objects into custom analysis tools, applications, and dashboards.
Panel works really well with the visualization tools you already know and love like Altair/ Vega, Bokeh, Datashader, Deck.gl/ pydeck, Echarts/ pyecharts, Folium, HoloViews, hvPlot, plotnine, Matplotlib, Plotly, PyVista/ VTK, Seaborn and more. Panel also works with the ipywidgets ecosystem.
Panel provides bi-directional communication making it possible to react to clicks, selections, hover etc. events.
You can develop in Jupyter Notebooks as well as editors like VS Code, PyCharm or Spyder.
Panel provides a unique combination of deployment options. You can share your data and models as
- a web application running on the Tornado (default), Flask, Django or Fast API web server.
- a stand alone client side application powered by Pyodide or PyScript via
panel convert
. - an interactive Jupyter notebook component.
- a static
.html
web page, a.gif
video, a.png
image and more.
Panel has something to offer for every one from beginner to data pro.
Panel is a member of the HoloViz ecosystem
Panel is a member of the ambitious HoloViz dataviz ecosystem and has first class support for the other members like hvPlot (simple .hvplot plotting api), HoloViews (powerful plotting api), and Datashader (big data viz).
Panel is built on top of Param. Param enables you to annotate your code with parameter ranges, documentation, and dependencies between parameters and code. With this approach,
- you don't ever have to commit to whether your code will be used in a notebook, a data app, in batch processing, or reports.
- you will write less code and be able to develop large, maintainable code bases!
Mini getting-started
Head over to the getting started guide for more!
Installation Instructions
Panel can be installed on Linux, Windows, or Mac with conda
:
conda install panel
or with pip
:
pip install panel
See the Environments section below for additional instructions for your environment.
Interactive data apps
Bring your data or model
def model(n=5):
return "â"*n
Bind it to a Panel widget and lay it out.
import panel as pn
pn.extension()
slider = pn.widgets.IntSlider(value=5, start=1, end=5)
interactive_model = pn.bind(model, n=slider)
layout = pn.Column(slider, interactive_model)
For deployment on a web server wrap it in a nice template.
pn.template.FastListTemplate(
site="Panel", title="Example", main=[layout],
).servable()
Start the server with
panel serve name_of_script.py --show
or
panel serve name_of_notebook.ipynb --show
Examples
Get started
Develop applications in your favorite notebook or editor environment, including Jupyter(Lab) notebooks, VSCode, Google Colab and many more, see our getting started guide for more details.
Support & Feedback
- Usage questions and showcases -> HoloViz Community
- Bug reports and feature requests -> Github
- Developer discussions -> Discord
For more detail check out the HoloViz Community Guide.
Contributing â¤ï¸
Check out the Contributing Guide.
License
Panel is completely free and open-source. It is licensed under the BSD 3-Clause License.
Sponsors
The Panel project is also very grateful for the sponsorship by the organizations and companies below:
Top Related Projects
Streamlit — A faster way to build and share data apps.
Data Apps & Dashboards for Python. No JavaScript Required.
Interactive Data Visualization in the browser, from Python
Voilà turns Jupyter notebooks into standalone web applications
Interactive Widgets for the Jupyter Notebook
Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot