Saving html file with images in bokeh

后端 未结 2 1706
生来不讨喜
生来不讨喜 2021-02-04 21:08

I\'m creating a bokeh plot containing several images. I create and show my file like this:

output_file(my_dir + \"Graphs\\\\graph\")
show(bar)

2条回答
  •  故里飘歌
    2021-02-04 21:32

    In case you are running into problems (especially working in an offline environment), you may want to consider adding the mode='inline' parameter:

    output_file('plot.html', mode='inline')
    

    This ensures that the required js/css is included in your output html. In this way, you create a standalone html.

    Combining with the existing code, this results in:

    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('plot.html', mode='inline')
    save(p)
    

    Check out this answer for further reference.

提交回复
热议问题