python - 在 Plotly 或 Python 中的 Bokeh 中的 map 上绘制散点饼图

标签 python plotly bokeh scatter-plot

是否可以在 Plotly 或 Bokeh 中的 map 上创建散点图,使每个散点成为迷你饼图?我在plotly.graph_objects.Scattermapbox和bokeh.plotting的文档中找不到信息。

最佳答案

因此,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)

关于python - 在 Plotly 或 Python 中的 Bokeh 中的 map 上绘制散点饼图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62195263/

相关文章:

python - 在Python中使用bokeh的图例显示顺序

python - 使用 pandas 和 bokeh 构建排序的条形图

python - 如何在python中使用套接字而无需等待

python - 使用PyCharm,似乎无法导入Pyperclip模块

python - __init__ 文件在 python 中没有按预期工作

python - GUI提供的评估公式

Python ggplot 和 ggplotly

python - 为什么 Plotly 不能在 Jupyter Lab 上运行?

Python:如何从 mlpd3、Bokeh、Plotly 中的链接画笔获取数据?

javascript - 上传 CSV 文件并在 Bokeh Web 应用程序中阅读