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 doesn't update when changing value of use_container_width #8576

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

Plotly chart doesn't update when changing value of use_container_width #8576

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 I have a Plotly chart with use_container_width=True, and I update it to use_container_width=False, the displayed chart won't update when doing a simple rerun. It requires a full reload of the page to update.

Reproducible Code Example

import plotly.graph_objects as go
import streamlit as st

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

  1. Run the app above.
  2. Look at the Plotly chart.
  3. Update use_container_width=True in the last line to use_container_width=False.
  4. Rerun the app (e.g. by pressing R).

Expected Behavior

The plot should change its size after the rerun.

Current Behavior

The plot does not change its size. But if you reload the entire website via the browser, it does change its size. Note that the other way around (changing from use_container_width=False to use_container_width=True) works as expected after a normal rerun.

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: Mac
  • 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
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