bokeh: GMapPlot doesn't display anything in Jupyter v.4

Hi,

Just started using Bokeh more extensively and I wanted to display maps within a Jupyter notebook. I tried running the example provided in the repo (with the world_cities dataset) and while it displays when ran alone, it only displays a blank area in Jupyter (and I could only see the data once (without a map) when I refreshed, but this is not consistent). I have both latest versions for bokeh and Jupyter (from Anaconda).

import bokeh
import bokeh.plotting as plotting
plotting.output_notebook()
from bokeh.io import push_notebook

from bokeh.resources import INLINE
from bokeh.models.glyphs import Circle
from bokeh.models import (
    GMapPlot, Range1d, ColumnDataSource,
    PanTool, WheelZoomTool, GMapOptions)
from bokeh.resources import INLINE
from bokeh.sampledata.world_cities import data


x_range = Range1d(-160, 160)
y_range = Range1d(-80, 80)

map_options = GMapOptions(lat=15, lng=0, zoom=10)

plot = GMapPlot(
    x_range=x_range,
    y_range=y_range,
    plot_width=1000,
    plot_height=500,
    map_options=map_options,
    title="Cities of the world with a population over 5,000 people.",
    webgl=True,
)
circle = Circle(x="lng", y="lat", size=5, line_color=None, fill_color='firebrick', fill_alpha=0.2)
plot.add_glyph(ColumnDataSource(data), circle)
plot.add_tools(PanTool(), WheelZoomTool())
plotting.show(plot)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 41 (21 by maintainers)

Most upvoted comments

I can confirm exactly the behavior that @canavandl has described:

  1. Map does not show but points do
  2. Opening dev tools makes map appear but points do

I’d also add that a brand new instance of IPython ntb creates the plot for about ~1 second correctly: map loads, points appear wrongly (1 sec), points move to the correct position (1 sec), map disappears as: screen shot 2016-08-17 at 10 30 17 pm

(Code almost unchanged from here http://bokeh.pydata.org/en/0.11.1/docs/user_guide/geo.html, the only thing is output_file -> output_notebook)

 
bokeh                     0.12.0                    <pip>
conda                     4.1.8                    py35_0  
conda-env                 2.5.2                    py35_0  
ipython                   5.0.0                    py35_0    conda-forge
ipywidgets                5.1.5                    py35_0    conda-forge
jsonschema                2.5.1                    py35_0    conda-forge
jupyter_client            4.3.0                    py35_0    conda-forge
jupyter_core              4.1.0                    py35_0    conda-forge
nbformat                  4.0.1                    py35_0    conda-forge
notebook                  4.2.1                    py35_0    conda-forge
numpy                     1.10.4          py35_blas_openblas_201  [blas_openblas]  conda-forge
openblas                  0.2.18                        3    conda-forge
pandas                    0.18.1              np110py35_0    conda-forge

Oh one last thing: adding api-key argument does not change any of the behavior described above.

I’m able to reproduce the issue described by @colliand and using his notebook from nbviewer.

With a hard-refreshed browser window (with the cache deleted), the gmap plot will load the first time. Rerunning the cell containing the show call causes a white window (containing the google watermark) to appear instead of the map:

screen shot 2016-07-25 at 11 13 52 am

Opening the dev tools will cause the plot to be rendered (presumably doing so causes the page to reflow), but the map coords aren’t the requested ones and the circle glyphs are missing:

screen shot 2016-07-25 at 11 15 15 am

Inspecting the network activity tab in the dev tools, it seems that there isn’t a gmap response payload when running the show method a second time even though AFAICT the request is happening. I would think that it’s an issue of how we’re interacting w/ the Google maps API, but it will require further investigation.

(thanks @colliand for the helpful notebook and bug description!)

@benuklove I just mean there have been various issues / possible issues and I think several of them got combined in this issue. It’s fine, I am going to work off the other issue first and see if it solves the problems described here too.

I can confirm this, no map on first run, no map and no glyphs after kernel restart. Page refresh causes glyphs to reappear, but still no map. No meaningful error messages in JS console. There are some related to comms when there are no glyphs rendered. I presume those errors obscure relevant information.