How to use a streamlit site on the smartphone?

Is it possible to adapt a site made in streamlit to mobile form? I generated my website, but when I open it on a smartphone, the graphics are super applied and I can’t reduce the size.

Hi @isa.rsn -

The unfortunate answer is yes and no. Streamlit does detect the screen size and will provide a responsive layout. But some libraries such as matplotlib often have pixel sizes hard-coded in, so you might have a 500px x 300px image and its size will be fixed.

So depending on what those graphics are, you’ll need to handle that yourself. If they do happen to be matplotlib graphics, a nice solution is to use Altair/Bokeh/plotly, as they are web-first visualization frameworks and tend to handle those types of issues nicely.

Best,
Randy

Thanks for the answer. I thought about adjusting the plot size according to the page size. For example, instead of using the height=800 argument, use another one that asks for the percentage of the page that will be occupied by the plot. Do you know if there is any argument that does this?

You can use columns, and assign to each column a percentage of the width you want to use

For example, if you have an image and want to give it 75% of width, do:
col1, col2 = st.columns([3,1])
That will create a column (col1) taking 3/4 (75%) of the space, leaving 25% for the other one (which you can also leave blank)