Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

White gap between Python folium map and jupyter notebook cell

Tags:

python

folium

How can I remove the undesired gap between the Python folium map and the next cell inside my jupyter notebook. Here the naive code to reproduce my problem :

import folium
m = folium.Map(width=600, height=400, location=[12, 12], zoom_start=2)
m

enter image description here

like image 780
olivier dadoun Avatar asked Mar 10 '26 09:03

olivier dadoun


1 Answers

Here the solution need to use Figure :

from branca.element import Figure
fig = Figure(width=600, height=400)
m = folium.Map(location=[12, 12], zoom_start=2)
fig.add_child(m)
like image 50
olivier dadoun Avatar answered Mar 11 '26 22:03

olivier dadoun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!