Bokeh 是一个 Python 交互式可视化效果库。Bokeh is a Python interactive visualization library.

若要使用 Bokeh,请通过 UI 安装 Bokeh PyPI 包,并将其附加到群集。To use Bokeh, install the Bokeh PyPI package through the Libraries UI, and attach it to your cluster.

若要在 Azure Databricks 中显示 Bokeh 绘图,请执行以下操作:To display a Bokeh plot in Azure Databricks:

  1. 按照 Bokeh 文档中的说明生成绘图。Generate a plot following the instructions in the Bokeh documentation.

  2. 通过某种方式(例如,使用 Bokeh 的 file_html()output_file() 函数)生成一个包含绘图数据的 HTML 文件。Generate an HTML file containing the data for the plot, for example by using Bokeh’s file_html() or output_file() functions.

  3. 将此 HTML 传递给 Azure Databricks displayHTML() 函数。Pass this HTML to the Azure Databricks displayHTML() function.


    笔记本单元格(内容和输出)的最大大小为 16MB。The maximum size for a notebook cell, both contents and output, is 16MB. 请确保传递给 displayHTML() 函数的 HTML 大小不超过此值。Make sure that the size of the HTML you pass to the displayHTML() function does not exceed this value.

有关示例,请参阅以下笔记本。See the following notebook for an example.

bokeh 演示笔记本bokeh demo notebook

获取笔记本Get notebook