Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't plot the map with folium

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

like image 936
kloud Avatar asked Nov 29 '25 02:11

kloud


1 Answers

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.

like image 82
desert_ranger Avatar answered Dec 02 '25 05:12

desert_ranger



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!