Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotly chart flickers when changing tabs #8575

Closed
3 of 4 tasks
jrieke opened this issue Apr 27, 2024 · 1 comment · Fixed by #8191
Closed
3 of 4 tasks

Plotly chart flickers when changing tabs #8575

jrieke opened this issue Apr 27, 2024 · 1 comment · Fixed by #8191
Labels
feature:st.plotly_chart priority:P3 status:confirmed Bug has been confirmed by the Streamlit team type:bug Something isn't working

Comments

@jrieke
Copy link
Collaborator

jrieke commented Apr 27, 2024

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

When using the same Plotly chart in two tabs, it flickers when switching between the tabs.

CleanShot.2024-04-27.at.17.32.15.mp4

Reproducible Code Example

import streamlit as st
import plotly.graph_objects as go

tabs = st.tabs(["Tab 1", "Tab 2"])
for tab in tabs:
    with tab:
        col1, col2 = st.columns(2)
        with col2:
            chart_values = [1, 2, 3, 4, 5]
            trend = go.Figure()
            trend.add_trace(go.Line(y=chart_values))
            st.plotly_chart(trend, use_container_width=True)

Steps To Reproduce

Run the app above, switch between the tabs.

Expected Behavior

Plot stays in place.

Current Behavior

Plot flickers, see video at the top. Note that this is especially pronounced when the Plot is in a column (as in the code example above) but it also has a (smaller) flicker when used outside of a column.

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: 1.33
  • Python version: 3.9
  • Operating System:
  • Browser: Chrome

Additional Information

No response

@jrieke jrieke added type:bug Something isn't working status:needs-triage Has not been triaged by the Streamlit team feature:st.plotly_chart labels Apr 27, 2024
Copy link

If this issue affects you, please react with a 👍 (thumbs up emoji) to the initial post.

Your feedback helps us prioritize which bugs to investigate and address first.

Visits

@LukasMasuch LukasMasuch added status:confirmed Bug has been confirmed by the Streamlit team priority:P3 and removed status:needs-triage Has not been triaged by the Streamlit team labels Apr 27, 2024
LukasMasuch added a commit that referenced this issue Apr 27, 2024
## Describe your changes

Improve the flickering issue when the width of the vertical block isn't
determined yet (==-1).

## GitHub Issue Link (if applicable)

- Related: #8575

---

**Contribution License Agreement**

By submitting this pull request you agree that all contributions to this
project are made under the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:st.plotly_chart priority:P3 status:confirmed Bug has been confirmed by the Streamlit team type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants