31

I am using Bokeh to produce HTML code including figures with show method This method ends on opening default browser with HTML opened in it.

I want to save the HTML code, without showing it. How can I do that ?

2 Answers 2

33

Solution is to replace calls to show by calls to save.

1
18

Use output_file({file_name}) instead of output_notebook(). You can call either save or show method. Remember each time you call save or show method the file will be rewritten.

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.