gpt4 book ai didi

python - 如何将 header 添加到 python 中的 Bokeh 仪表板?

转载 作者:行者123 更新时间:2023-12-05 02:53:41 29 4
gpt4 key购买 nike

我在 bokeh 中创建了一个仪表板,但我如何向它添加一个通用标题?

enter image description here我之前做了很多研究,但似乎以前没有人问过这个简单的问题。

谢谢你帮助我:)

最佳答案

正如 Eugene 提到的,您可以使用 div 容器设置标题,然后在列输出中设置它。

下面是一些可能有助于理解的示例代码:

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)

关于python - 如何将 header 添加到 python 中的 Bokeh 仪表板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62086673/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com