【问题标题】:Bokeh: Dynamically update the location of a vertical line.散景:动态更新垂直线的位置。
【发布时间】:2019-02-24 23:43:18
【问题描述】:

按照示例散景文档,我使用以下几行在现有散景图中添加了一条垂直线:

from bokeh.models import Span
important_time = Span(location=shift_no, dimension='height', line_color='red', line_dash='dashed', line_width=3)
my_figure.add_layout(important_time)

我根据在某些小部件中所做的选择动态更新图窗的源数据。每个新数据的垂直线都应该改变。上述代码不断在现有竖线中添加新竖线的问题,不足为奇。

有人知道删除先前垂直线或仅更新其位置的方法吗?我在散景服务器上运行它,以防对解决方案产生任何影响。

【问题讨论】:

    标签: python layout bokeh interactive


    【解决方案1】:

    如果您使用的是 Bokeh 服务器,您可以简单地将位置设置为新值:

    important_time.location = new_value
    

    【讨论】:

    • 谢谢!效果很好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-30
    • 1970-01-01
    相关资源
    最近更新 更多