'My Plotly plots are cut off in my Streamlit app
I'm plotting some data in Streamlit and the site looks great on my desktop. However when I view it on my mobile device the right side is cut off. My code:
fig = go.Figure()
fig.add_trace(go.Scatter(x=[time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(t)) for t in times], y=[i for i in range(num_times)], mode='lines+markers'))
st.plotly_chart(fig)
How can I fix this?
Solution 1:[1]
You can force the plot to have the right width on mobile by changing the line
st.plotly_chart(fig)
to
st.plotly_chart(fig, use_container_width=True)
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tom Dörr |
