Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/main/08. Data Visualization with Python/09. Dash Basics.ipynb
Views: 4586
Dash Components
Objectives
Create a dash application layout
Add HTML H1, P, and Div components
Add core graph component
Add multiple charts
Dataset Used
Airline Reporting Carrier On-Time Performance dataset from Data Asset eXchange
Lab Questions
We will be using the same pie and sunburst chart theme from Plotly basics lab.
Theme for Pie Chart
Proportion of distance group (250 mile distance interval group) by month (month indicated by numbers).
Theme for Sunburst Chart
Hierarchical view in othe order of month and destination state holding value of number of flights.
Load the data
Proportion of distance group (250 mile distance interval group) by month (month indicated by numbers).
Let's start creating dash application
Theme
Proportion of distance group (250 mile distance interval group) by month (month indicated by numbers).
To do:
Import required libraries and create an application layout
Add title to the dashboard using HTML H1 component
Add a paragraph about the chart using HTML P component
Add the pie chart created above using core graph component
Run the app
Hints
General examples can be found here.
For step 1 (only review), this is very specific to running app from Jupyterlab.
For Jupyterlab,we will be using
jupyter-dash
library. Addingfrom jupyter_dash import JupyterDash
import statement.Instead of creating dash application using
app = dash.Dash()
, we will be usingapp = JupyterDash(__name__)
.
For step 2,
Title as
Airline Performance Dashboard
Use
style
parameter and make the title center aligned, with color code#503D36
, and font-size as 40. CheckMore about HTML
section here.
For step 3,
Paragraph as
Proportion of distance group (250 mile distance interval group) by month (month indicated by numbers).
Use
style
parameter to make the description center aligned and with color#F57241
.
For step 4, refer dcc.Graph component usage.
For step 5, you can refer examples provided here.
NOTE: Run the solution cell multiple times if you are not seeing the result.