Using the command line¶
However, this isn’t the only way to work with the library. The
line tool often offers better flexibility and makes iteration easier and faster.
Create standalone HTML documents from any kind of Bokeh application source such as Python scripts, app directories, or JSON files.
Generate a serialized JSON representation of a Bokeh document from any kind of Bokeh application source.
Publish Bokeh documents as interactive web applications.
An advantage of using the
bokeh command on a command line is that the code
you write does not have to specify any particular output method or format. You
can write just the visualization code and decide how to output the results
later. This simplifies the above example as follows:
from bokeh.plotting import figure, curdoc p = figure() p.line(x=[1, 2, 3], y=[4,6,2]) curdoc().add_root(p)
You can now run
bokeh html foo.py to generate a standalone HTML file
bokeh serve foo.py to start serving this document as a web application.