bokeh 0.12.10 not rendering Segments on GMapPlot

╄→гoц情女王★ 提交于 2019-12-11 12:35:14

问题


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)

回答1:


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.



来源:https://stackoverflow.com/questions/47428123/bokeh-0-12-10-not-rendering-segments-on-gmapplot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!