Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bokeh GMapPlot Segments Not Rendering [duplicate]

I am trying to display line segments on a map using GMapPlot. The lines flashes in red and then disappears, in jupyter notebook. This is my code (some decimals left out):

map_options = GMapOptions(lat=37.88, lng=-122.23, map_type="roadmap", zoom=10)
plot = GMapPlot( 
  x_range=DataRange1d(), y_range=DataRange1d(), map_options=map_options
)
source = ColumnDataSource( data = dict(
    y=[ 37.762260 ],
    x=[-121.96226],
    ym01=[37.762290 ],
    xm01=[-121.96189 ]
)

segment = Segment(x0="x", y0="y", x1="xm01", y1="ym01",line_color="green", line_width=100)
plot.add_glyph(source, segment)
plot.add_tools(PanTool(), WheelZoomTool(), BoxSelectTool())
output_notebook()
show(plot)
like image 387
user2498899 Avatar asked Nov 19 '22 15:11

user2498899


1 Answers

UPDATE This issue is resolved in https://github.com/bokeh/bokeh/pull/8240 which will be part of Bokeh 1.0



I've tried to reproduce with updated code:

from bokeh.io import show
from bokeh.models import GMapOptions, ColumnDataSource
from bokeh.plotting import figure, gmap

map_options = GMapOptions(lat=37.88, lng=-122.23, map_type="roadmap", zoom=10)
plot = gmap(google_api_key=API_KEY, map_options=map_options)

source = ColumnDataSource( data = dict(
    y=[ 37.762260 ],
    x=[-121.96226],
    ym01=[37.762290 ],
    xm01=[-121.96189 ]
))

plot.segment(x0="x", y0="y", x1="xm01", y1="ym01",line_color="green", line_width=10, source=source)

show(plot)

And can confirm that the segment does not show up. Slightly changing to show circles does work, so I have to conclude that this is a bug of some sort. Please file a detailed GitHub issue to report this bug.

like image 133
bigreddot Avatar answered Nov 21 '22 04:11

bigreddot