使用以下代码:
import bokeh.plotting as bplt
bplt.output_file('output.html', mode="cdn")
我得到一个带有我的图表的 html 文件;但它有文字:
You have 1 plots
Close All Plots
图表上方。
有没有办法在没有此文本的情况下生成 html 输出?
As of Bokeh 0.5 there is a much more convenient embed module, which should provide the functionality you desire.
In your specific case, I would suggest the following setup:
Load BokehJS from CDN at the top of your page (or in the head)
<script src="http://cdn.bokeh.org/bokeh-0.5.1.js"></script>
In the Python script generating the plots, run
bokeh.embed.components(bokeh.plotting.curplot(), bokeh.resources.CDN)
for each plot. That will return a tuple with a <script>
string containing the plot generation code, and a <div>
string you can place anywhere on your page as a target.