Plotly中的散点饼图或Python中的Bokeh

2024-06-28 19:04:58 发布

您现在位置:Python中文网/ 问答频道 /正文

是否有可能在Plotly或Bokeh内的地图上创建散点图,使每个散点成为迷你饼图?在plotly.graph\u objects.Scattermapbox和bokeh.plotting的文档中找不到信息


Tags: 文档信息objects地图bokehplottingplotlygraph
1条回答
网友
1楼 · 发布于 2024-06-28 19:04:58

因此,版本2.3.0中的Bokeh是解决方案(旧版本可能也可以)。 您可以在sarswpolsce.pl上找到工作示例 在this use-case中介绍的p.wedge的使用可以挽救生命

以下是所需效果的伪代码:


    p = figure(x_range=(mercator_x_min, mercator_x_max),
               y_range=(mercator_y_min, mercator_y_max),
               x_axis_type="mercator", y_axis_type="mercator",
               tools=TOOLS, output_backend="webgl", #for faster rendering
               plot_width = plot_w, plot_height = plot_h,
               title = "title")
    
    p.add_tile(tile_provider)
    
    for w in coordinates.keys():
        lat, lon = converter(coordinates[w][0], coordinates[w][1])
        renderdict[w] = p.wedge(x=lon, y=lat, radius=radius_, alpha = alpha_,
                                start_angle=cumsum(f'Angle_{w}', include_zero=True),
                                end_angle=cumsum(f'Angle_{w}'),
                                line_color="white", fill_color=f'Color_{w}',
                                legend_field= legend,
                                source=data_source, name = w)

相关问题 更多 >