I would like to display a plot that updates over real time based on predictions, similar to the Plotting Demo in the hello example. However, st.chart() is fast, but has too limited customization. Currently I am trying matplotlib, but the results are being displayed too slow.
How do the other available plotting libraries that work with streamlit (bokeh, plotly, Vega Lite etc.) compare with matplotlib based on customization and especially speed?
Under the hood, st.chart() uses Altair, which is a library for declaratively building interactive charts that are then displayed in the browser with Vega-Lite.
(Matplotlib, in contrast, is not a browser-aware library; instead, it creates non-interactive charts that Streamlit displays as static images. Any time you make a change to a Matplotlib chart, Streamlit has to re-render the entire thing to an image, and then send that image to the browser, which is much slower.)
Streamlit can handle arbitrary Altair charts via the st.altair_chart() function. The Altair docs have a ton of great examples you can use to get started on more sophisticated charts!
Streamlit also has support for deck.gl which can be used to create really stunning charts. But you don’t get the benefit of using Python syntax to declare your chart, like you do with Altair; instead, you’ll need to describe your chart in deck.gl’s json syntax. (The deck.gl playground can help you with this.)
My personal preference is Altair, because it’s Python and therefore comfortable to work in from a Streamlit script - unless I’m trying to get the most beautiful visuals possible, in which case I’d reach for deck.gl.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.