1
以下是我用於清除Bokeh服務器中的高級圖表的示例代碼。我想通過點擊按鈕清除舊的高級圖,但我無法清除舊圖。 Sample screenshot無法清除散景服務器中的文檔
from bokeh.charts import Bar
from bokeh.layouts import column
from bokeh.models.widgets import Button
from bokeh.plotting import curdoc
from bokeh.sampledata.autompg import autompg as df
button = Button(label="Clear")
def clear():
curdoc().clear()
p = Bar(df, 'cyl', values='mpg',
title="Total MPG by cyl")
button.on_click(clear)
curdoc().add_root(column(button,p))