简体   繁体   English

Plotly 中的 map 或 Python 中的散景散点图

[英]Scatter pie chart on map in Plotly or Bokeh in Python

Is there a possibility to create a scatter plot on a map within Plotly or Bokeh to make every single scatter point a mini pie chart?是否有可能在 Plotly 或 Bokeh 内的 map 上创建散点 plot 以使每个散点成为迷你饼图? I can't find info in docs of plotly.graph_objects.Scattermapbox and bokeh.plotting.我在 plotly.graph_objects.Scattermapbox 和 bokeh.plotting 的文档中找不到信息。

So, Bokeh in version 2.3.0 has been the solution (old versions will probably work too).因此,2.3.0 版中的 Bokeh 一直是解决方案(旧版本可能也可以使用)。 You can find working example on sarswpolsce.pl Usage of p.wedge presented in this use-case is life-saving.您可以在sarswpolsce.pl上找到工作示例此用例中提供的 p.wedge 的使用可以挽救生命。

Here is pseudocode for desired effect:这是所需效果的伪代码:


    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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM