是否可以使用 Bootstrap、Jiinja 或类似工具在 Bokeh 上布置绘图和小部件?

Is possible to lay out plots and widgets on Bokeh with Bootstrap, Jiinja or similar?

我有一个带有 Bokeh 库的应用程序,将其用作 Web 服务器应用程序。我使用选项卡、widgetdboxes、gridplots 来布置所有元素。我已阅读文档页面上的 this,但我发现这种方式存在很多限制。

有没有一种简单的方法可以使用模板布置所有这些元素?也许使用 Jinja 和 Bootstrap?这可能吗?

一个简单的例子会对我有很大帮助。

更新(2018 年 7 月 11 日)

模板功能随 0.13.0 Version of Bokeh

一起发布

Below is a minimal example. Assuming that the application creates two roots with names properties set:

p1 = figure(..., name="scatter")

p2 = figure(..., name="line")

curdoc().add_root(p1)
curdoc().add_root(p2)

Then these roots can be referred to by name in the template, and passed to the embed macro to place them wherever desired:

{% extends base %}

<!-- goes in head -->
{% block preamble %}
    <link href="app/static/css/custom.min.css" rel="stylesheet">
{% endblock %}

<!-- goes in body -->
{% block contents %}
    <div> {{ embed(roots.scatter) }} </div>
    <div> {{ embed(roots.line) }} </div>
{% endblock %}

从 Bokeh 0.12.5 开始,仅独立的 Bokeh 文档(即没有 Bokeh 服务器)通过 components 函数支持单个元素的模板化。 Bokeh 服务器应用程序元素的类似功能仍然是一个悬而未决的问题:#4986 Allow elements to be placed in server templates。目前,所有元素(绘图、小部件等)都必须采用 Bokeh 布局。