7

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

olivier dadoun
  • 622
  • 6
  • 22

1 Answers1

11

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)
user2957945
  • 2,353
  • 2
  • 21
  • 40
olivier dadoun
  • 622
  • 6
  • 22
  • I believe folium has its own figure implementation, so not sure branca is needed here, but good to know about the option to use it. – ZenoArrow Aug 08 '22 at 00:01