【问题标题】:Bokeh: save plot (as HTML) but don't show it散景:保存绘图(作为 HTML)但不显示
【发布时间】:2015-10-12 07:33:08
【问题描述】:

我想保存 HTML 代码,但不显示它。我该怎么做?

【问题讨论】:

    标签: python html plot save bokeh


    【解决方案1】:

    解决方案是将对show 的调用替换为对save 的调用。

    【讨论】:

    【解决方案2】:

    使用output_file({file_name}) 而不是output_notebook()。您可以调用saveshow 方法。请记住,每次调用 save 或 show 方法时,文件都会被重写。

    bokeh.io documentation

    from bokeh.plotting import figure, output_file, save
    
    p = figure(title="Basic Title", plot_width=300, plot_height=300)
    p.circle([1, 2], [3, 4])
    output_file("output_file_name.html")
    save(p)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-04
      • 2017-12-31
      • 1970-01-01
      • 2022-10-01
      • 2018-04-23
      • 1970-01-01
      • 1970-01-01
      • 2015-07-26
      相关资源
      最近更新 更多