Real-time visualizations
In this part, you will see how to set up a simple real-time visualization using Plotly's Dash. This tool is a great dashboarding tool for data scientists, as it is easy to learn and does not require much except for a Python environment.
The code is a little bit too long to show in the book, but you can find the Python file (called ch3-realtimeviz.py
) in the GitHub repository.
In the code, you can see how a simple real-time graph is built. The general setup of the code is to have an app. You define the layout in the app using HTML-like building blocks. In this case, the layout contains one div (one block of content) in which there is a graph.
The main component is the use of the Interval
function in this layout. Using this will make the dashboard update automatically at a given frequency. It is fast enough to consider these as real-time updates.
The callback decorates the function that is written just below it (update_graph
). By decorating it...