什么是“重置"命令?散景图? [英] What's the command to "reset" a bokeh plot?

查看:59
本文介绍了什么是“重置"命令?散景图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个散景人物,它在工具栏中有一个重置按钮.基本上,当我更新在图中绘制的数据时,我想重置"该图.我该怎么办?

I have a bokeh figure that has a reset button in the toolbar. Basically, I want to "reset" the figure when I update the data that I'm plotting in the figure. How can I do that?

推荐答案

更新:已为此功能提交了PR.散景0.12.16释放后,将执行以下操作:

UPDATE: A PR has been submitted for this feature. After Bokeh 0.12.16 is released, the following will work:

from bokeh.io import show
from bokeh.layouts import column
from bokeh.models import Button, CustomJS
from bokeh.plotting import figure

p = figure(tools="reset,pan,wheel_zoom,lasso_select")
p.circle(list(range(10)), list(range(10)))

b = Button()
b.js_on_click(CustomJS(args=dict(p=p), code="""
    p.reset.emit()
"""))

show(column(p, b))


从散景0.12.1开始,没有内置函数可以执行此操作.为此,可以制作一个自定义扩展.但是,这需要一些工作,实验和对话.如果您想采用该选项,建议您访问公共邮件列表,它比SO更适合于迭代式协作和讨论.另外,请随时在项目问题跟踪器上打开功能请求


As of Bokeh 0.12.1 there is no built in function to do this. It would possible to make a custom extension that does this. However, that would take a little work and experimentation and dialogue. If you'd like to pursue that option, I'd encourage you to come to the public mailing list which is better suited to iterative collaboration and discussion than SO. Alternatively, please feel free to open a feature request on the project issue tracker

这篇关于什么是“重置"命令?散景图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆