我想知道是否可以在同一个 IPython 笔记本中使用 Bokeh 生成静态 HTML 输出和内联图。我目前看到的是,一旦我打电话output_notebook()
or output_file("myfile.html")
我被困在使用那种输出方式。例如,如果我最初使用output_notebook
,随后调用output_file
不创建输出文件。
reset_output()
在下一个之前output_notebook
or output_file
call 至少在 0.10.0 版本中有效。
# cell 1
from bokeh.plotting import figure, show, output_notebook, output_file, reset_output
p = figure(width=300, height=300)
p.line(range(5), range(5))
output_notebook()
show(p)
# cell 2
reset_output()
output_file('foo.html')
show(p)
# cell 3
reset_output()
output_notebook()
show(p)
第一个和第三个显示在笔记本中,第二个显示在浏览器中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)