Having used st.placeholder to go back to the 'default' chart and settings, is there a way to make the transition more smooth?

The below Gif is a result of the placeholder being applied. The issue is when I select a new option from the available options, the graph goes ‘off’ and then re-appears. Is there a way to make this more smooth?

Code is here

Based on your code, I think this is less about using st.empty() as a placeholder, but the fact that matplotlib/seaborn re-draw the entire scene each time the graph changes. For the original use case, where people created publication-quality graphics, the render time was acceptable, but for web, it can be a bit broken.

The best solution I can suggest for now would be to use one of the web-based plotting libraries if you can: plotly, altair, bokeh. All of these are built with the web use case in mind, and as such, as much more selective about which elements are common between runs and which ones need to be re-drawn.


Thanks for your response, will try this later today. :slight_smile:

Sorry this took a while to get to. O_o

So I was able to figure out the first part which was why the chart flashes. I had saved the inputs as st.beta_columns() whilst the chart was not saved in one. Saving the chart in its own st.beta_columns pretty much solves this issue.

With regards to the select box that does not reset or resets only for a second, I am still figuring this one out.


I think streamlit form might help you.

Thanks, I just noticed its update. Will have a try this weekend :slight_smile: