John P. S.
John P. S.

Reputation: 383

Streamlit map occupying the entire background

I'm currently building an application with Streamlit and I'd like to plot a map which fills the entire background. Is there a way to do so in Streamlit? I have following code:

import streamlit as st
import folium 
from streamlit_folium import folium_static

m = folium.Map(location=[-22.908333, -43.196389], zoom_start=11, tiles='OpenStreetMap')
folium_static(m)

But the generated map does not fill all the browser available space. I'd like to fill the browser available space like in the example below

Example that I found on the internet: Example

Upvotes: 1

Views: 2631

Answers (1)

Ailurophile
Ailurophile

Reputation: 3005

You can set your Streamlit app to use wide mode with st.set_page_config(layout="wide").

It needs to be the first streamlit call you make (i.e. first thing you do after importing streamlit). This will allow you to make use of the whole screen.

import streamlit as st
import folium 
from streamlit_folium import folium_static

st.set_page_config(layout="wide")

m = folium.Map(location=[-22.908333, -43.196389], zoom_start=11, tiles='OpenStreetMap')
folium_static(m)

And I don't know about the streamlit_folium, you may need to increase the plot size

Upvotes: 2

Related Questions