Member-only story
Creating Dynamic Dashboards with Streamlit
Using Streamlit to develop dynamically updated data visualizations
Introduction
For those of us who have heralded all the bells and whistles brought into existence by Streamlit, from its ease of use to its ability to create powerful visualizations, we’ve largely overlooked one really handy feature. Its ability to render dynamic dashboards that can be updated in real time. I gather that most users are using Streamlit to create static dashboards or at most are utilizing the multitude of widgets available to redact dataframes that are then fed back into their visualizations. But I haven’t really seen anyone using one of the greatest inherent capabilities of Streamlit - to create instantaneously and constantly changing visuals. Bring in the mighty ‘placeholder.’
Streamlit Placeholders
Placeholders in Streamlit figuratively allow you to reserve a spot at the table should you choose to use it later at a time of your choice or not at all. As per Streamlit’s own API, the placeholder:
Inserts a container into your app that can be used to hold a single element. This allows you to, for example, remove elements at any point, or replace several elements at once (using a child multi-element container).
Perhaps it was solely designed to enable you to retroactively insert an element or widget just once into your code post an event. Regardless, it gives us this unique vantage to be able to constantly feed a stream of anything into the placeholder, effectively rendering a dashboard that is updating in real time. Without further ado, let me show you how to create a radar chart that is updated continuously.
Packages
First thing’s first, lets go ahead and insert the stack of packages we’ll be using.
And incase you need to install any of the above packages, please proceed by using ‘pip install’ in Anaconda prompt.