如何从绘图中删除渲染器?

2024-09-27 23:49:08 发布

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

我正在试用Bokeh服务器。我有一个文件有三个数字,我正在尝试更新其中两个,这取决于我在第三个数字上执行的选择。两个图形中要绘制的行数每次都会发生变化。在

如果我可以使用multi_line,这将很简单:我将更改multi_line的数据源中的xs和ys。 唉,我需要使用多个散点图,因为多条线不支持悬停,我需要它。在

所以,我想完成的是每次我在第三个选项中选择某个对象时清除这两个图,并显示与新选择相对应的散点图。在

当然,有一些可能的解决办法(例如,将散布点附加到一个包含所有散点图的glyprenderer中,但这意味着使用非常笨拙的方式发送正确的悬停消息…)。但如果可以只清除和更新单个数字,一切都会更干净。但是我在文件里找不到任何东西。在


Tags: 文件对象服务器图形选项linebokeh绘制
1条回答
网友
1楼 · 发布于 2024-09-27 23:49:08

我读过the thread you created on the mailing list和这篇{a2},布莱恩说:

Technically, glyph renderers are stored in the .renderers property of Plots, but I would not recommend rooting around there by hand. Specifically the "Continuous Updating" notebook I linked earlier has an example of updating both the data and appearance of an existing glyph using python and push_notebook. There is not any easy way to remove glyphs at the moment, other options would be:

  • recreate a new plot
  • set the glyph to be invisble
  • update the glyphs data

因此,目前看来它们是唯一的解决办法

相关问题 更多 >

    热门问题