Python 使用Bokeh显示和更新文本:更新时的设置图示符不起作用

Python 使用Bokeh显示和更新文本:更新时的设置图示符不起作用,python,bokeh,Python,Bokeh,我正在尝试编写一个web应用程序,它显示带有Bokeh的图形,还显示从API检索的格式化文本。当用户单击按钮时,显示会随图形的内容而动态变化。是否有一种标准的方式来格式化和呈现文本,然后用Bokeh更新文本 我原以为我可以用文字符号来做这件事,但到目前为止我失败了。以下是我试图为更新操作所做的: def update_graph(attrname, old, new): USER_ID = new use_df = get_user_df(new, cur, date_from

我正在尝试编写一个web应用程序,它显示带有Bokeh的图形,还显示从API检索的格式化文本。当用户单击按钮时,显示会随图形的内容而动态变化。是否有一种标准的方式来格式化和呈现文本,然后用Bokeh更新文本

我原以为我可以用文字符号来做这件事,但到目前为止我失败了。以下是我试图为更新操作所做的:

def update_graph(attrname, old, new):
    USER_ID = new

    use_df = get_user_df(new, cur, date_from, date_to)
    plot1.title = get_api_output(new, INSIGHT_DATE)

    textplot.text(3, 3, text=["hellllllo"], text_color="firebrick", text_align="center", text_font_size="20pt")

    source1.data['x'] = use_df[use_df['type'] == 0]['date'].values
    source1.data['y'] = use_df[use_df['type'] == 0]['value'].values
这种方式基本上可以正常工作。我使用
get\u user\u df
从远程数据库中获取一些数据,并更新
source1
,这可以正常工作。同样,标题也会根据需要进行更新

但是,
textplot
上没有显示文本图示符,控制台中也没有出现错误。发生了什么?如何动态调整绘图上的文本图示符

此外,以下是我用于设置相关绘图的代码:

#plot utilities
def mtext(p, x, y, text):
    p.text(x, y, text=[text],
           text_color="firebrick", text_align="center", text_font_size="10pt")

#PLOTS

textplot = Figure(toolbar_location = None, title = 'API text', title_text_font_size='8pt')
mtext(textplot, randint(2, 5), randint(2, 5), 'annotation')

plot1 = Figure(toolbar_location = None, title = 'Distance (k)', title_text_font_size='8pt')
source1 = ColumnDataSource(data = dict(x = use_df[use_df['type'] == 0]['date'].values, y = use_df[use_df['type'] == 0]['value'].values))
plot1.circle('x', 'y', line_color=None, source = source1, color = 'pink', size = 20)

请阅读。如果你能提供一个完整的脚本,我可以快速看一下,但我不能花时间来填补所有的空白,以便能够测试一些东西。