Bokeh在gmap上添加补丁后未生成图形

问题描述 投票:0回答:1

我正在尝试在bokeh中的gmap上绘制多边形。如果我生成一个空白图并像上面那样添加数据,

tractfigure = figure(title = "Share of tract population that are beyond 1 mile from supermarket, Travis County",
             plot_height = 600, plot_width = 600,
             toolbar_location = "right",
             tools = "pan,wheel_zoom")
tractfigure.xgrid.grid_line_color = None
tractfigure.ygrid.grid_line_color = None

tractfigure.patches('xs','ys', source = data_source,fill_color = {'field' :'plotted_data', 'transform' : color_mapper},
          line_color = 'black', line_width = 0.25, fill_alpha = 1)

它将根据绘制的数据字段生成具有多个具有不同颜色的多边形的图形。 GmapPlot对象没有补丁功能,因此我尝试使用add_glyph函数添加补丁。


plot = GMapPlot(x_range = Range1d(), 
               y_range = Range1d(),
               map_options = map_options,
               plot_width = 600,
               plot_height = 600)
plot.api_key = "secret"
patch = Patches(xs = 'x', ys = 'y',
               fill_color = {"field": 'plotted_data', "transform": color_mapper},
               fill_alpha = 0.7, line_color = "black", line_width = 1)
plot.add_glyph(data_source, patch)

这会编译,但bokeh会生成一个空对象。如何在gmapplot上映射GeoJSONDataSource?

python gis bokeh geopandas
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.