正如Eugene提到的,你可以使用div-container来设置标题,然后在列输出中设置。
这里有一些例子代码,可能会有助于理解。
output_file("slider.html")
title = Div(text='<h1 style="text-align: center">Example Header</h1>')
p1 = figure(plot_width=300, plot_height=300)
p1.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)
tab1 = Panel(child=p1, title="circle")
p2 = figure(plot_width=300, plot_height=300)
p2.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=3, color="navy", alpha=0.5)
tab2 = Panel(child=p2, title="line")
tabs = Tabs(tabs=[tab1, tab2])
layout = column(title, tabs, sizing_mode='scale_width')
curdoc().add_root(layout)
只要把你的dashboard包裹在一个 column
其中第一项是 Div
与标题文字。