Interactive Dashboards With Plotly & Dash
Interactive Dashboards With Plotly & Dash
This is a project-based course for students looking for a practical, hands-on approach to
learning Plotly and Dash for building interactive visualizations & dashboards using Python
Quizzes & Assignments to test and reinforce key concepts, with step-by-step solutions
Interactive demos to keep you engaged and apply your skills throughout the course
Dive deep into the Plotly library and use it to build & customize several chart
2 Plotly Figures & Chart Types types, including line charts, bar charts, pie charts, scatterplots, and histograms
4 Dashboard Layouts Learn how to organize your visualizations and interactive components into a
visually appealing and logical structure
Take your applications to the next level by learning how to update your
5 Advanced Functionality application with real-time data, develop chained-callback functions, and more!
PROJECT: Building A Dashboard to Help Agents Find The Best Ski resorts For Customers
*Copyright Maven Analytics, LLC
THE COURSE PROJECT
You’ve just been hired to join the Analytics team at Maveluxe Travel, a high-end
THE
travel agency with best-in-class services for helping customers find the perfect
SITUATION resorts based on their preferences
Your task is to build interactive visuals and dashboards to help Maveluxe’s travel
THE agents pick the best ski resorts for their customers based on their very picky tastes.
ASSIGNMENT We will build a dashboard that includes interactive maps and report cards for ski
resorts around the world.
This course covers the core functionality for Plotly & Dash
• We’ll focus on adding interactivity to charts and constructing dashboard applications
1) Once inside the Jupyter interface, create a folder to store your notebooks for the course
NOTE: You can rename your folder by clicking “Rename” in the top left corner
2) Open your new coursework folder and launch your first Jupyter notebook!
NOTE: You can rename your notebook by clicking on the title at the top of the screen
NOTE: When you launch a Jupyter notebook, a terminal window may pop up as
well; this is called a notebook server, and it powers the notebook interface
In this section we’ll introduce the Plotly & Dash libraries, and cover the steps & key
components for creating a basic Dash application with interactive Plotly visuals
Adding interactivity to charts lets your stakeholders explore the data and
conduct their own analysis, freeing up your time to tackle more problems
“Can you build me a line chart “Great, now can you make “Thank you! What is the exact
showing transactions by store another chart but zoom in for value for store 3 on Dec 3? I
over time?” December 2013?” was also curious about 2015…”
Adding interactivity to charts lets your stakeholders explore the data and
conduct their own analysis, freeing up your time to tackle more problems
2) Install jupyter-dash via pip This helps develop apps in Jupyter before Application Run
If you get a warning that “a new version of conda exists” during the
installation, you can ignore it or run the code specified in the output
Back End
Inputs
Outputs
1 2 3 4 5
Import the Create the Dash Set up the Add the callback Run the
necessary libraries application HTML layout functions application
This is all you need to create the world’s simplest dash app:
You can use JupyterDash to run the app in-notebook as you’re designing it
PRO TIP: Use JupyterDash to quickly and easily to iterate on your app inside the
notebook – you can switch to Dash for Application Run once it’s finished (more later!)
To build dashboards using Plotly & Dash, you may need to import these libraries:
Library for data prep & ETL Library for adding Plotly visuals
Importing specific functions and modules from dash instead of the full library helps when
writing the code, as you don’t need to reference the library when calling each function
Dash uses HTML layouts for designing the front-end of the application
• Use the html module to specify the visual components and assign it to app.layout
Familiarity with the HTML and CSS web design languages can be a big help for making
beautiful applications – we will conduct a brief crash course on the basics later!
Dash has many interactive elements that can be added to apps for user input
• These are provided by the Dash Core Components module (dcc)
Slider Slider for selecting a single value from a pre-defined list These interactive elements
are useless until they are
RangeSlider Slider for selecting a range of values from a pre-defined list
processed in the back-end
Checklist Multi-select checkboxes from a pre-defined list with callback functions
Dash has many interactive elements that can be added to apps for user input
• These are provided by the Dash Core Components module (dcc)
Callback functions process user inputs and update the app accordingly
• They are triggered by a change to a property of an HTML component (input)
• They then change the property of another HTML component (output)
dcc.Dropdown
id = "color-input"
options = ["Red", "Green", "Blue"]
value = ""
html.Div
id = "color-output"
children = "Color selected: None"
Callback functions process user inputs and update the app accordingly
• They are triggered by a change to a property of an HTML component (input)
• They then change the property of another HTML component (output)
dcc.Dropdown
id = "color-input"
options = ["Red", "Green", "Blue"]
value = "Green"
""
html.Div Callback
function
id = "color-output"
children = "Color selected: Green"
None"
Callback functions are defined by using the @app.callback decorator and have
at least two arguments (Output & Input), followed by the function itself
@app.callback(
Output(component_id, component_property),
Input(component_id, component_property))
The Input & Output The id of the html component that The property of the html component that
arguments of the triggers (input) or gets modified by is passed into (input) or gets modified by
callback decorator (output) the callback function (output) the callback function
(Output goes first!) Examples:
• “children” (for text)
• “value” (for interactive elements)
• “figure” (for charts)
Callback functions are defined by using the @app.callback decorator and have
at least two arguments (Output & Input), followed by the function itself
@app.callback(
Output(component_id, component_property),
Input(component_id, component_property)
)
def function_name(variable):
#function steps
return f"Output: {variable}"
Defines the callback function and New value for the property
assigns the value from the property of of the output component
the input component to a variable
Callback functions are defined by using the @app.callback decorator and have
at least two arguments (Output & Input), followed by the function itself
Callback functions run as soon as the app launches by default, but you can add
logic to prevent updates
• This can help avoid errors when interactive elements are in an “empty state”
There are several Application Run options you can use when running the app:
• debug=True: helps with troubleshooting during development (i.e., better error messages)
• host/port: specify the server address of the app – the default is: http://127.0.0.1:8050/
• mode="inline": runs the app in-notebook when using JupyterDash (not an option in Dash)
• height/width: set the height or width of the app in pixels or a percentage
PRO TIP: The host/port options become more important when deploying your application;
and setting width as a percentage is a great way to keep your app proportions consistent!
Results Preview
NEW MESSAGE
March 3, 2023
Thanks!
section01_assignments.ipynb
Solution Code
NEW MESSAGE
March 3, 2023
Thanks!
section01_solutions.ipynb
You can add interactive Plotly visuals to Dash apps with these 3 steps:
1. Create a “prototype” visual using Pandas & Plotly without interactivity
2. Identify the element that changes and define its options in the interactive component
3. Connect the interactive component to the visual using a callback function
Create one “view” of the visual Use the values for the different Create the chart in the callback
as if you had interacted with it “views” as the interactive options function to bring it all together
STEP 1 Create a “prototype” visual using Pandas & Plotly without interactivity
Anscombe’s quartet is a
group of four datasets
with nearly identical
regression lines but
significantly different You can use Plotly Express and the You can then filter the DataFrame
visual relationships px.scatter function to plot the “x” to only plot one dataset at a time
and “y” columns in the DataFrame
Note that this plots all four datasets
in Anscombe’s quartet
STEP 1 Create a “prototype” visual using Pandas & Plotly without interactivity
STEP 2 Identify the element that changes and define its options in the interactive component
STEP 3 Connect the interactive component to the visual using a callback function
Results Preview
NEW MESSAGE
March 3, 2023
Hey,
Thanks!
section01_assignments.ipynb
Solution Code
NEW MESSAGE
March 3, 2023
Hey,
Thanks!
section01_solutions.ipynb
Plotly & Dash are Python libraries for creating interactive visuals
• Plotly lets you build charts and Dash lets you interact with them by deploying them as web applications
In this section we’ll dive into the Plotly library and use it to build & customize several chart
types, including line charts, bar charts, pie charts, scatterplots, histograms, and maps
Charts are created by defining a figure object, Charts are created with Plotly Express functions,
and traces are customized using figure methods with most customization options built in
You can create these basic charts with Plotly Express by using these functions
• You simply need to select a DataFrame as the first argument and specify the DataFrame
columns to plot for the rest of the arguments (just be mindful of data types!)
y y
x x x
names
y y
values
x x
You can create these basic charts with Plotly Express by using these functions
• You simply need to select a DataFrame as the first argument and specify the DataFrame
columns to plot for the rest of the arguments (just be mindful of data types!)
numerical
These are the data types!
categorical
numerical
categorical
numerical numerical
Results Preview
NEW MESSAGE
March 7, 2023
Hey there,
Can you look at the Spanish ski data and see if skiing is still as
popular in Spain as it was back then?
Thanks!
section02_assignments.ipynb
Solution Code
NEW MESSAGE
March 7, 2023
Hey there,
Can you look at the Spanish ski data and see if skiing is still as
popular in Spain as it was back then?
Thanks!
section02_solutions.ipynb
You can plot multiple series by using the “color” argument on most chart types
You can plot multiple series by using the “color” argument on most chart types
You can turn a stacked bar chart into a grouped bar chart with barmode=“group”
Results Preview
NEW MESSAGE
March 9, 2023
Hey there,
Thanks!
section02_assignments.ipynb
Solution Code
NEW MESSAGE
March 9, 2023
Standard Bar Chart:
From: Leonard Lift (Ski Trip Concierge)
Subject: National Lift Characteristics
Hey there,
Thanks!
section02_solutions.ipynb
You can turn a scatterplot into a bubble chart by using the “size” argument
You can turn a pie into a donut chart by using the “hole” argument
• Other options include changing the sort order, and modifying the color sequence
Results Preview
NEW MESSAGE
March 9, 2023
Hi again,
Then build a donut chart breaking down lift types for the
resort with the highest lift capacity.
section02_assignments.ipynb
Solution Code
NEW MESSAGE
March 9, 2023
Bubble Chart:
Hi again,
Donut Chart:
Thanks for getting me those charts, the client was really
pleased! Somewhat related, this client hates waiting in line at
lifts, and believes resorts with high lift capacity and lift
numbers will have shorter waits. They also prefer Gondola
lifts. Can you build a bubble chart that compares TotalLifts to
LiftCapacity with the size of each marker as the number of
Gondola Lifts?
Then build a donut chart breaking down lift types for the
resort with the highest lift capacity.
section02_solutions.ipynb
Histogram options include setting the number of bins, using relative frequencies,
and adding data labels
Update methods let you format Plotly Express charts using object-oriented
commands, combining the best of both worlds!
• While Plotly Express does have formatting options, update methods are occasionally useful
For a full list of arguments, visit: https://plotly.com/python/reference/index/ *Copyright Maven Analytics, LLC
UPDATE LAYOUT
The .update_layout() method lets you customize figure and plot elements
• This is commonly used to modify the title and legend formatting, as well as fonts and colors
The .update_layout() method lets you customize figure and plot elements
• This is commonly used to modify the title and legend formatting, as well as fonts and colors
The .update_traces() method lets you modify the formatting of the plotted data
• This is commonly used to change the styling, colors, and opacity
This adds markers to the line charts and changes their opacity
The .update_xaxes() & .update_yaxes() methods let you format each axis
• This is commonly used to customize the gridlines, ranges, and tick marks
For the x-axis, this changes the title, removes the gridlines,
modifies the range of years, and sets the ticks every 4 years
For the y-axis, tis changes the title, and sets 5 ticks in total
The .add_annotation() method lets you call out key data points in charts
The .add_trace() method lets you add shapes (like reference lines!) to charts
Results Preview
NEW MESSAGE
March 12, 2023
Hi,
Thanks!
section02_assignments.ipynb
Solution Code
NEW MESSAGE
March 12, 2023
Hi,
Thanks!
section02_solutions.ipynb
Plotly Express also has functions for map-based visuals using geographical data:
• px.choropleth uses geographic regions (countries, states, etc.)
• px.scatter_mapbox and px.density_mapbox use latitude & longitude pairs
PRO TIP: Plotly has built-in options for plotting countries and US states, but Googling
examples for other regions is a great way to avoid creating a custom solution from scratch
Mapbox maps use an open-source mapping API integrated into Plotly to create
map-based visuals using latitude & longitude pairs
Mapbox maps use an open-source mapping API integrated into Plotly to create
map-based visuals using latitude & longitude pairs
Results Preview
NEW MESSAGE
March 11, 2023
Ok,
This is hopefully the last need for our client (and me, the lowly
concierge).
Thanks!
section02_assignments.ipynb
Solution Code
NEW MESSAGE
March 11, 2023
Ok,
This is hopefully the last need for our client (and me, the lowly
concierge).
Thanks!
section02_solutions.ipynb
Use update methods to customize the layout, plot, and axes of your charts
• These leverage the object-oriented approach to creating charts for combining the best of both worlds
In this section we’ll cover interactive elements from the Dash Core Components module,
and use them to provide different data inputs for manipulating Plotly visuals in Dash apps
The Dash Core Components (dcc) module has several interactive elements that
can be used in Dash apps to create dynamic dashboards with Plotly figures
dcc.Dropdown() Dropdown list of options for the user to select (or multi-select) ==, !=, in, not in
dcc.Checklist() Checkboxes with options for the user to select or deselect ==, !=, in, not in
dcc.RadioItems() Radio buttons with options for the user to toggle between ==, !=, in, not in
dcc.Slider() Slider with a handle for the user to drag and select values with ==, <, <=, >, >=
dcc.RangeSlider() Slider with two handles for the user to drag and select ranges with .between(value[0], value[1])
dcc.DatePickerSingle() Dropdown calendar for the user to select a date with ==, <, <=, >, >=
dcc.DatePickerRange() Dropdown calendar for the user to select a date range with .between(start, end)
For a full list of arguments, visit: https://dash.plotly.com/dash-core-components *Copyright Maven Analytics, LLC
DROPDOWN MENUS
Dropdown menus provide a list of options for the user to select (or multi-select)
• dcc.Dropdown(id, options, value, multi)
EXAMPLE Changing the dependent “x” variable in a scatterplot with a regression line
The selection gets passed into the callback function and used as the
“x” variable in the scatterplot, returning the updated chart
EXAMPLE Changing the dependent “x” variable in a scatterplot with a regression line
You can create multi-select dropdown menus with the “multi” argument
• This passes a list to the callback function instead of a string
The “in” logical operator lets you process the list, and the
“color” argument plots a series for each state
You can create multi-select dropdown menus with the “multi” argument
• This passes a list to the callback function instead of a string
Checklists provide a list of options for the user to select (or multi-select)
• dcc.Checklist(id, options, value)
Checklists provide a list of options for the user to select (or multi-select)
• dcc.Checklist(id, options, value)
Results Preview
NEW MESSAGE
March 20, 2023
Thanks!
section03_assignments.ipynb
Solution Code
NEW MESSAGE
March 20, 2023
Thanks!
section03_solutions.ipynb
Radio buttons provide a list of options for the user to toggle between
• dcc.RadioItems(id, options, value)
Radio buttons provide a list of options for the user to toggle between
• dcc.RadioItems(id, options, value)
Sliders let users drag a handle to select a value inside a defined range
• dcc.Slider(min, max, step, value)
Sliders let users drag a handle to select a value inside a defined range
• dcc.Slider(min, max, step, value)
Range sliders let users drag two handles to select a range of values
• dcc.RangeSlider(min, max, step, value)
Range sliders let users drag two handles to select a range of values
• dcc.RangeSlider(min, max, step, value)
Results Preview
NEW MESSAGE
March 23, 2023
Ok,
Can you build a bar chart that shows number of ski resorts by
country based on the elevation users select?
Thanks!
section03_assignments.ipynb
Solution Code
NEW MESSAGE
March 23, 2023
Ok,
Can you build a bar chart that shows number of ski resorts by
country based on the elevation users select?
Thanks!
section03_solutions.ipynb
Date pickers let users select a date from a calendar drop down
• dcc.DatePickerSingle(id, min_date_allowed, max_date_allowed, initial_visible_month, date,
display_format)
Date pickers let users select a date from a calendar drop down
• dcc.DatePickerSingle(id, min_date_allowed, max_date_allowed, initial_visible_month, date,
display_format)
Date range pickers let users select a range of dates from calendar drop downs
• dcc.DatePickerRange(id, start_date, end_date, display_format)
Date range pickers let users select a range of dates from calendar drop downs
• dcc.DatePickerRange(id, start_date, end_date, display_format)
Results Preview
NEW MESSAGE
March 25, 2023
Hey there,
Thanks!
Section03_assignments.ipynb
Solution Code
NEW MESSAGE
March 25, 2023
Hey there,
Thanks!
Section03_solutions.ipynb
Dash has a wide range of interactive elements you can use in apps
• Choose the right one by considering the data types, number of options, and filtering criteria (logical comparisons)
Key Objectives
NEW MESSAGE
March 28, 2023 1. Build two working Dash Applications
From: Deepthi Downhill (VP of Analytics) 2. Add multiple chart types and interactive elements
Subject: More Ambitious Ski Resort App
3. Connect them with callback functions capable of
taking multiple inputs and returning multiple outputs
Hello,
That said, it’s time to think a bit bigger. While Europe is a solid
market, it’s behind the US and Canada for us given our
customers are almost exclusively from North America. Can
you create two apps that will help us with these markets?
Thanks!
section04_midcourse_project.ipynb
In this section we’ll introduce dashboard design principles and build dashboard layouts in
Dash, including some more advanced HTML and the Dash Bootstrap Components library
Dashboards are groups of visuals that help understand data and make decisions
• They can be used for both exploratory and explanatory analysis
EXPLORATORY EXPLANATORY
We’ll mostly focus on dashboards for exploratory analysis in this course, but you can check
out our Data Visualization with Matplotlib & Seaborn for good explanatory examples
PRO TIP: Think like a business owner before you think like an analyst; before you begin building
your dashboard with code, take time to understand the outcomes you’re trying to impact, the key
stakeholders and their motivations, and the specific purpose your dashboard will serve
A strong dashboard layout adds cohesion to its visuals & interactivity, drawing
attention to key metrics and guiding the viewer through a logical progression
Nationwide view of test performance and other KPIs State-level deep dive with context on relative ranks
KPIs
PRO TIP: Design your dashboard layout like an inverse pyramid; the most important metrics
and visuals should come first, followed by any supporting data or more granular views
Fine detail
Dash uses HTML layouts for designing the front-end of the application
• Use the html module to specify the visual components and assign it to app.layout
Styles specified for html Divs will cascade to standard html elements within them,
but dcc components override these styles by default (more on this later!)
Dash uses HTML layouts for designing the front-end of the application
• Use the html module to specify the visual components and assign it to app.layout
These are the basic HTML components you need to get started:
html.Div() A web page section (you can use multiple Divs to create sections with different styles)
html.H1(), H2(), …, H6() Different sized headers used to denote hierarchy or importance (more so than size itself)
html.P() A paragraph, or generic body text, often smaller than and placed immediately below a header
html.Span() Inline containers used to apply different colors or styles to text within headers or paragraphs
For a full list of components, visit: https://dash.plotly.com/dash-html-components *Copyright Maven Analytics, LLC
PRO TIP: MARKDOWN
You can also use dcc.Markdown() to embed text into the front-end of your app
PRO TIP: Markdown is easier to write and more convenient for things like modifying font weight and
building lists than HTML – it’s a bit harder to style, but generally more than sufficient for most apps!
Results Preview
NEW MESSAGE
April 1, 2023
Hey there,
Thanks!
Section05_assignments.ipynb
Solution Code
NEW MESSAGE
April 1, 2023
Hey there,
Thanks!
Section05_solutions.ipynb
This sets a light grey Arial font on a black background for the app
components, except for the final paragraph (this has a grey
background color with an absurdly small font size)
These are the basic arguments for modifying HTML styles you need to get started:
DCC components don’t inherit parent Div styles, but some styling can be applied
• NOTE: Only some portions of DCC components can be styled without modifying the CSS code
DCC components don’t inherit parent Div styles, but some styling can be applied
• NOTE: Only some portions of DCC components can be styled without modifying the CSS code
DCC components don’t inherit parent Div styles, but some styling can be applied
• NOTE: Only some portions of DCC components can be styled without modifying the CSS code
DCC components are deceptively difficult to style because they are defined by
Dash’s CSS, but there are ways to get around this without needing to know CSS
Results Preview
NEW MESSAGE
April 3, 2023
Hey there,
Let’s modify the color and text on the Ski Resorts by Country
map that we worked on.
Thanks again!
section05_assignments.ipynb
Solution Code
NEW MESSAGE
April 3, 2023
Hey there,
Let’s modify the color and text on the Ski Resorts by Country
map that we worked on.
Thanks again!
section05_solutions.ipynb
The Dash Bootstrap Components (DBC) library offers incredible options for
designing polished applications with fewer lines of code
• This includes cohesive styles, built-in padding around components, and a grid-based framework
These are the basic Dash Bootstrap Components you need to get started:
dbc.themes Pre-built CSS style sheets that apply cohesive formatting to your application
dbc.Container() The DBC equivalent of a Div that acts as a style wrapper for sections of the app layout
dbc.Card() A specific type of container for components that adds padding & polish around them
PRO TIP: Use Dash Bootstrap Components to quickly apply a theme to your dashboard,
then tweak individual elements as needed with the methods we’ve already covered
For a full list of components, visit: https://dash-bootstrap-components.opensource.faculty.ai/ *Copyright Maven Analytics, LLC
DASH BOOTSTRAP THEMES
The DBC Theme Explorer (linked below) has an app for previewing the different
themes available – odds are you will find one that matches your desired aesthetic!
For an interactive theme viewer, visit: https://dash-bootstrap-components.opensource.faculty.ai/docs/themes/explorer/ *Copyright Maven Analytics, LLC
DASH BOOTSTRAP THEMES
You can apply themes to DCC components by using a special link (see code below)
• You also need to specify className=“dbc” in your dcc component
You can apply your own CSS code with the same steps; Learning CSS is generally well beyond the scope of
analyst roles, but it’s worth being aware of if you have the web developer skills (or want to learn them!)
The DBC components for rows & columns let you create grid-based layouts
• The height of each row is determined by the height of its content
• You can specify the width of each column or let them distribute evenly by default
The DBC components for rows & columns let you create grid-based layouts
• The height of each row is determined by the height of its content
• You can specify the width of each column or let them distribute evenly by default
The DBC components for rows & columns let you create grid-based layouts
• The height of each row is determined by the height of its content
• You can specify the width of each column or let them distribute evenly by default
You can create dashboards with multiple tabs with dcc.Tabs() and dcc.Tab()
• Simply specify any number of dcc.Tab() components underneath parent dcc.Tabs()
Results Preview
NEW MESSAGE
April 05, 2023
Hey there,
Can we modify the layout of the map application? I’d like for
our interactive elements to be in a bar on the left side of our
screen, with the map to the right.
Thanks again!
Section05_assignments.ipynb
Solution Code
NEW MESSAGE
April 05, 2023
Hey there,
Can we modify the layout of the map application? I’d like for
our interactive elements to be in a bar on the left side of our
screen, with the map to the right.
Thanks again!
Section05_solutions.ipynb
You can create dashboard layouts with HTML, markdown, and DBC
• Dash Bootstrap Components (DBC) let you easily create grid-based layouts with multiple tabs
• The focus of the layout should be to add cohesion to its visuals and interactive elements
In this section we’ll cover advanced topics like chained & conditional callback functions,
cross-filtering, debug mode, data table outputs, and app deployment options
You can embed data tables into your dashboards with the dash_table module
• dash_table.DataTable(columns, data)
You can use additional arguments to let users sort, filter, and export the table
• dash_table.DataTable(columns, data, filter_action, sort_action, export_format)
The “native” options for sorting and filtering work quite well
You can also export to “xlsx”
Results Preview
NEW MESSAGE
April 11, 2023
Hey there,
Thanks!
Section06_assignments.ipynb
Solution Code
NEW MESSAGE
April 11, 2023
Hey there,
Thanks!
Section06_solutions.ipynb
Return different components to the front end based on some conditional logic
Modify the options of an interactive element based on the option selected in another
Filter figures in the app based on the data selected (or hovered over) in another figure
Prevent app updates until the user initiates the callback process, or “applies changes”
Updates the app by initiating the callback process at fixed time intervals
Dash is extremely powerful and flexible. These concepts are worth being aware of, but
good dashboards are often quite simple, so you may never use most of these in practice
Chained callbacks use the output of a callback function as the input of another
• This is typically used to modify the options of an interactive element based on the option
selected in another (like dependent dropdown lists)
The second dropdown has cities in California as options The second dropdown has cities in Oregon as options
Chained callbacks use the output of a callback function as the input of another
• This is typically used to modify the options of an interactive element based on the option
selected in another (like dependent dropdown lists)
The first callback takes the value from the first dropdown as the
input, and uses it as the key to return its values from the
“states_cities” dictionary as options for the second dropdown
You can turn on debug mode when running an app to look at the structure of your
callbacks, diagnose errors, and identify components causing poor performance
• app.run_server(debug_mode=True)
You can turn on debug mode when running an app to look at the structure of your
callbacks, diagnose errors, and identify components causing poor performance
• app.run_server(debug_mode=True)
Cross-filtering uses chart selections as inputs to callbacks that filter other charts
The app loads by plotting “California” in the second chart As you hover over states in the first chart, the second chart updates
Cross-filtering uses chart selections as inputs to callbacks that filter other charts
You can add a button component to your app that run callbacks manually,
allowing users to make multiple selections before applying any updates
• This helps if your application has long processing times (common in ML models)
The first chart relies on inputs from the radio buttons on the left, The first chart now displays values based on the user selections, and
but the callback function won’t fire until the user clicks “Submit” is also filtering the second chart by the selected data point
(the second chart is displaying default values, and is unrelated to
the radio buttons on the left)
You can add a button component to your app that run callbacks manually,
allowing users to make multiple selections before applying any updates
• This helps if your application has long processing times (common in ML models)
This app is set to “refresh” every 2 seconds In 10 seconds, 5 callbacks have triggered every 2 seconds
This can allow for real-time updates if your application is connected to a database or API, so instead of firing a
random number generator, new data can be queried and appended to your DataFrame via pd.read_sql()
Results Preview
NEW MESSAGE
April 20, 2023
Hey there,
Thanks!
section06_assignments.ipynb
Solution Code
NEW MESSAGE
April 20, 2023
Hey there,
Thanks!
section06_solutions.ipynb
This is hosted on
PythonAnywhere
Check out my deployed app at: https://cwbruehl.pythonanywhere.com/ *Copyright Maven Analytics, LLC
PYTHONANYWHERE
You can deploy your app on PythonAnywhere for free by following these steps:
You can deploy your app on PythonAnywhere for free by following these steps:
You can deploy your app on PythonAnywhere for free by following these steps:
You can deploy your app on PythonAnywhere for free by following these steps:
You can deploy your app on PythonAnywhere for free by following these steps:
8) In the “Web” tab, edit the WSGI configuration file with the code below and click “Save”
Your username
You can deploy your app on PythonAnywhere for free by following these steps:
10) Specify the file path to your app in the “Source code”
You can deploy your app on PythonAnywhere for free by following these steps:
Key Objectives
NEW MESSAGE
May 1, 2023 1. Build a multi-tab dashboard with a grid-based layout
From: Deepthi Downhill (VP of Analytics) 2. Add multiple chart types and interactive elements
Subject: Even MORE Ambitious Resort App
3. Write standard callback functions to connect them
Hey, thanks for the great work on the two dashboards. 4. Include a chained callback function and (if you’re
However, I’m getting some feedback that having two separate daring) a cross-filtering callback function
dashboards is challenging to navigate. Can you make this a
single app, with each view on its own tab? Try to improve the
design a bit as well.
Thanks!
section07_final_project.ipynb