3

I am running a simple example:

import gmaps
import gmaps.datasets

gmaps.configure(api_key="...")
earthquake_df = gmaps.datasets.load_dataset_as_df( 'earthquakes' ) 
locations = earthquake_df[[ 'latitude' , 'longitude' ]] 
weights = earthquake_df[ 'magnitude' ] 
fig = gmaps.figure() 
fig.add_layer(gmaps.heatmap_layer(locations, weights=weights)) 
fig

but instead of seeing a heatmap, the output shows this:

Figure(layout=FigureLayout(height='420px'))

I am using Spyder (Python 3.7)

Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124
Junxian
  • 105
  • 9

1 Answers1

2

(Spyder maintainer here) The reason is very simple: Spyder can't show web content on its consoles. By web content I mean content that can only be rendered in a web browser. and that's the case for the gmaps package.

Carlos Cordoba
  • 33,273
  • 10
  • 95
  • 124
  • I see. Is there a way around this? Also why am I being downvoted here? Is this a bad question? – Junxian Mar 14 '19 at 02:01
  • No, there's no workaround right now. And you probably got downvoted because your question was not clear enough to other people. – Carlos Cordoba Mar 14 '19 at 08:44
  • I'm using folium instead now. It doesn't render too. But at least I can export it as html . – Junxian Mar 14 '19 at 09:48
  • @CarlosCordoba Is there any alternative to ```gmaps``` package to get google maps, that is working in Spyder? – AAAA Dec 17 '19 at 15:51
  • 1
    @MariuszSiatka, I don't think so. However, we're planning to add a viewer for web content on Spyder 5 (to be released in 2020), that should fix this problem. – Carlos Cordoba Dec 17 '19 at 16:11