简体   繁体   English

如何将图例变成下拉列表?

[英]How to make legend into dropdown?

Currently, I am working on a map visualization project using Bokeh.目前,我正在使用 Bokeh 进行 map 可视化项目。

Because the legend of the map is too many, the legend crowded the map.因为map的传说太多,传说挤满了map。 Is there any way to make the legend into something like a dropdown menu in Bokeh?有什么方法可以将图例变成像 Bokeh 中的下拉菜单之类的东西? Thank you谢谢

In Bokeh, the widget is called Select .在 Bokeh 中,小部件称为Select There's no function like legend_to_select if that's what you want.如果你想要的话,没有像legend_to_select这样的 function。 But you can just avoid creating the legend at all and create the select widget manually.但是您可以完全避免创建图例并手动创建 select 小部件。 You will have to manually hook it up to the glyphs via a CustomJS callback and it won't support displaying glyphs since it supports only text.您必须通过CustomJS回调手动将其连接到字形,并且它不支持显示字形,因为它仅支持文本。 If you require displaying glyphs as well, you will have to create a custom Bokeh model that extends Select and overrides the item rendering mechanism.如果您还需要显示字形,则必须创建自定义 Bokeh model 扩展Select并覆盖项目呈现机制。

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

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