#197: Creating Interactive Dashboards With Dash
Wit Plotly we can already create interactive plots and find the data points we are interested in. Would it not be great if we could add some more interactivity and combine multiple plots to a dashboard? Luckily for us, we can do exactly that with Dash.
Installation
Dash is written by the same people who created Plotly and allows us to create a dashboard application on top of Flask. You can install Dash with this command:
Dash comes in an open-source edition and as a commercial tool. For my posts I will only cover the open-source edition.
Our first Dash application
We reuse our knowledge for Plotly and take the tips data set for our first interactive dashboard:
This reads the data set, creates a minimalistic Flask app with a title label, a dropdown list for the day, and a placeholder for our plot. The callback brings us the interactivity and when we change a value in the dropdown list, the plot is refreshed automatically.
We can run this little application in the command line with this command:
If you open the web browser, you should see this minimalistic application:

Our visualisation is a full-featured Plotly interactive plot, where we can zoom in, hover over data points, and save it to disk.
Main components of Dash
In Dash we need these three main components to create an interactive dashboard:
- Layout: The html.* methods allow us to control the appearance of our application. Instead of writhing the HTML tags directly, we use them through the html.* methods. You can find the full list of supported tags in the documentation.
- Core components: The dcc.* methods are there for the placement of graphs and interactive widgets. The full list of components contains the plot area we used above, buttons, date pickers, confirmation dialogs, and nearly everything that allows you to interact with a web site.
- Callbacks: The @app.callback() decorator is where we combine the interactive controls with our own methods and enforce the updates of the plots. We can bind Input() to Output() and filter the data on the go.
Fast development loops
Since Dash is built on top of Flask, we can profit from the auto-reload feature of Flask. If we run our Dash application from the command line, everything we need is already in place through the debug=True parameter in app.run(). We can make a change in our Dash application file, save it and Flask automatically reloads the application in the browser.
For IDEs like Visual Studio Code, we need to change the configuration, as I described it in my older post Python Friday #33: Activate Auto-Reload for Flask in VS Code.
Next
The great benefit of Dash is that we can reuse all our knowledge of Plotly. We created a small but interactive Dash application to work with the tips data set.
Next week we extend this small app into one with multiple plots that we can update based on our selections.