What is a fast and proper way to refresh/update plots in Bokeh (0.11) server app?

不羁的心 提交于 2019-12-03 00:22:40
bigreddot

If you are streaming data, then there is a related answer here: Timeseries streaming in bokeh

If you need update everything at once, then you can do that, and my suggestion is your Strategy 1, which is demonstrated, e.g. here:

https://github.com/bokeh/bokeh/blob/master/examples/app/sliders.py

The particular thing to note is that you really have to update all of source.data in one go. One of the assumptions is that all the columns of a column data source always have the same length. Updating individual columns runs the risk of breaking this assumption, which can cause problems. So you want to update all at once, with something like:

# Generate the new curve
x = np.linspace(0, 4*np.pi, N)
y = a*np.sin(k*x + w) + b

source.data = dict(x=x, y=y)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!