是否可以在不使用show()的情况下在Bokeh中显示和更新Pandas图?这个在线有什么例子吗?我似乎找不到任何东西。例如,像:
def bar_plot(fig, source):
p = pd.DataFrame()
p = p.from_dict(source.data)
fig = p.plot.bar()
return fig
def update_data():
data = source.data
data['y'] = random.sample(range(0,100),len(data['y']))
source.data = data
button.on_click(update_data)
source = ColumnDataSource(data)
fig = bar_plot(fig, source)
layout = layout([[button,fig]])
curdoc().add_root(layout)
答案 0 :(得分:0)
熊猫'内置.plot
方法使用Matplotlib生成图像。 Bokeh服务器无法跨Python / JS边界同步或更新MPL图。 Bokeh服务器只能显示和更新使用原生Bokeh API创建的图(即您可以使用Figure.vbar
或类似的Bokeh函数从数据框创建条形图。)