Plotly not responsive mobile screen

I am trying to build a lineplot using plotly. However, whenever it is accessed from smaller screens, such as a mobile, it does not apply the responsive widths and forces you to horizontally scroll the page, in order to visualize the whole plot.


Everything else is responsive (apart from the plotly graphs).
Additionally, I tried to change the width of the plotly structure, and it seems to work fine! Although, I don’t have any way to retrieve the dynamic screen width (so I could calculate the length I would need, and thus solve the responsive issue myself).

Screen-Recording-2020-05-03-at-1 (1)
This is the best I could reach so far.

Something as simple as width = st.screen.width would solve my point, as well as many others that require a minimum javascript aperture to work.

What should I do to guarantee a mobile-friendly app?
Thanks! :slight_smile:

1 Like

Hello @caio.hc.oliveira, welcome to the forums !

Would the default behavior of st.plotly_chart(fig, use_container_width=True) answer this ?



1 Like

Yes!! I couldn’t find it anywhere!
I was looking at examples of streamlit scripts built with plotly and it seems a great sum of people is not aware as well.

I am going to structure the question with examples so it can serve as a doc.
Thanks @andfanilo !