Interactive Dashboard from Jupyter with Voila
Last Updated :
15 Apr, 2025
Jupyter Notebook is used for data visualization, exploration and analysis. Voila is a Python package that allows you to convert Jupyter Notebooks into interactive web applications and we can create interactive web dashboards in it without modify any code. This means you can share your analysis with anyone even if they don't have any Python knowledge. In this article you’ll learn how to convert a Jupyter Notebook into interactive dashboard using Voila
Creating an Interactive Dashboard with Voila
Here is the step-by-step guide to creating an Interactive Dashboard from Jupyter Notebook with Voila:
Step1: Install Voila
Before you start. You need to install voila. You can do this directly from your Jupyter Notebook or from the command line using pip:
pip install voila
Step 2: Create file in Jupyter Notebook
Now open Jupyter Notebook and create a new file. This is where you’ll write the code that powers your dashboard. Start by importing the required libraries like numpy, pandas and plotly.
Python
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objs as go
import plotly.figure_factory as ff
import warnings
warnings.filterwarnings("ignore")
from IPython.core.display import display, HTML
from IPython.display import display as ipy_display
Use HTML tags to add headings and descriptions to your dashboard. For example:
Python
display(HTML('<h1 style="text-align:center;">Visualization for Voila Dashboard</h1>'))
display(HTML('<p style="text-align:center;"><strong>This is a sample dashboard created with Jupyter Notebook & Voila.</strong></p>'))
Output:
Now that we've set up our notebook and added some basic headings let's load our dataset and take a look at the first few rows. We'll use the pandas
library, which makes it super easy to read data files and work with tables.
Python
reviews = pd.read_csv("/content/winequality-red.csv", index_col=0)
reviews.head()
Output:
Wine Quality DatasetStep 3: Visualize Data with Plotly
Use Plotly to create interactive visualizations. Here are examples of different types of plots:
Scatter Plot
We will create a scatter plot to visualize the relationship between the 'Alchol' and 'Wine Quality' columns of a DataFrame named 'reviews' using an interactive scatter plot.
Python
fig = px.scatter(reviews, x='alcohol', y='quality',
title='Alcohol Content vs. Wine Quality',
labels={'alcohol': 'Alcohol (%)', 'quality': 'Wine Quality'},
color='quality')
ipy_display(fig)
Output:
Scatter plot between wine Quality and Alcohol2D Histogram Contour Plot
It consists of a 2D histogram contour plot and a scatter plot showcasing a combination of 2D histogram contour plot and a scatter plot to visualize the distribution and relationship between the 'Alcohol' and 'pH' columns of a DataFrame named 'reviews'.
Python
fig = px.histogram(reviews, x='quality', nbins=10,
title='Distribution of Wine Quality Ratings',
labels={'quality': 'Wine Quality'})
ipy_display(fig)
Output:
2D plot between Alcohol and pHThe above plot is a 2D histogram contour showing that most alcohol vs pH data points are concentrated around 9.5–10 alcohol and 3.2–3.4 pH.
3D Surface Plot
It processes and filters data from a DataFrame named 'reviews', transforms it and generates an interactive 3D surface plot representing the relationship between 'points' and 'price'.
Python
df = reviews.assign(n=0).groupby(['citric acid', 'pH'])['n'].count().reset_index()
df = df[df['pH'] < 4.5]
z_data = df.pivot(index='pH', columns='citric acid', values='n').fillna(0).values.tolist()
fig = go.Figure(data=[go.Surface(z=z_data)])
fig.update_layout(title='3D Surface Plot of Citric Acid and pH')
ipy_display(fig)
Output:
3d surface plot of citric acid and pHThis plot shows a 3D surface of citric acid and pH indicate high variability in z-values at low citric acid and pH levels.
Step 4: Deploy on a Server
- Save your Jupyter Notebook containing your dashboard.
- Open terminal or command prompt and use the
cd
command to navigate to the directory where your Jupyter Notebook is saved. - Run the following command in the terminal
Voila Voila_Dashboard.ipynb
Then it will automatically launch on your local host in your browser.
Similar Reads
Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co
11 min read
Linear Regression in Machine learning Linear regression is a type of supervised machine-learning algorithm that learns from the labelled datasets and maps the data points with most optimized linear functions which can be used for prediction on new datasets. It assumes that there is a linear relationship between the input and output, mea
15+ min read
Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
10 min read
Logistic Regression in Machine Learning Logistic Regression is a supervised machine learning algorithm used for classification problems. Unlike linear regression which predicts continuous values it predicts the probability that an input belongs to a specific class. It is used for binary classification where the output can be one of two po
11 min read
Class Diagram | Unified Modeling Language (UML) A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact
12 min read
K means Clustering â Introduction K-Means Clustering is an Unsupervised Machine Learning algorithm which groups unlabeled dataset into different clusters. It is used to organize data into groups based on their similarity. Understanding K-means ClusteringFor example online store uses K-Means to group customers based on purchase frequ
4 min read
K-Nearest Neighbor(KNN) Algorithm K-Nearest Neighbors (KNN) is a supervised machine learning algorithm generally used for classification but can also be used for regression tasks. It works by finding the "k" closest data points (neighbors) to a given input and makesa predictions based on the majority class (for classification) or th
8 min read
Backpropagation in Neural Network Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and
9 min read
3-Phase Inverter An inverter is a fundamental electrical device designed primarily for the conversion of direct current into alternating current . This versatile device , also known as a variable frequency drive , plays a vital role in a wide range of applications , including variable frequency drives and high power
13 min read
What is Vacuum Circuit Breaker? A vacuum circuit breaker is a type of breaker that utilizes a vacuum as the medium to extinguish electrical arcs. Within this circuit breaker, there is a vacuum interrupter that houses the stationary and mobile contacts in a permanently sealed enclosure. When the contacts are separated in a high vac
13 min read