3

I folowed the documentation here: https://python-visualization.github.io/folium/quickstart.html but I can't plot the map.

import folium


m = folium.Map(location=[45.5236, -122.6750])
m

the output is just :

Out[67]: <folium.folium.Map at 0x263ecc9a908>


PS: branca-0.4.1, folium-0.11.0, python 3.5

enter image description here


I think that the problem is due to the use of spyder insteed of jupiter !
Is there a way to plot it in spyder ?
any help will be appreciated

kloud
  • 221
  • 1
  • 10

1 Answers1

4

The problem is folium generates maps that are web-based. Hence, spyder fails to render it. This is a possible work-around* -

import folium
import webbrowser

m = folium.Map(location=[45.5236, -122.6750])
m.save("map_1.html")
webbrowser.open("map_1.html")

A similar question was posted on StackOverflow - Folium map not displaying in Spyder, but the answers didn't seem to exactly solve the issue, hence I posted my answer over here.

desert_ranger
  • 1,096
  • 3
  • 13
  • 26
  • thank you it works for me, I wanted a map in the form of a figure so that I can return it in a dialog system. But an html solution can do the goal ;) – kloud Jun 06 '20 at 09:26