This docs on this page refers to a PREVIOUS VERSION. For the latest stable release, go to https://docs.bokeh.org/

Archived docs for versions <= 1.0.4 have had to be modified from their original published configuration, and may be missing some features (e.g. source listing)

All users are encourage to update to version 1.1 or later, as soon as they are able.

svg — Bokeh 1.0.3 documentation

svg

To generate standalone SVGs for a Bokeh application from a single Python script, pass the script name to bokeh svg on the command line:

bokeh svg app_script.py

The generated SVGs will be saved in the current working directory with the name app_script.svg. If there are multiple SVGs within an application, the subsequent ones will be named app_script_1.svg, app_script_2.svg, etc.

It is also possible to run the same commmand with jupyter notebooks:

bokeh svg app_notebook.ipynb

This will generate SVG files named app_notebook_{n}.svg just like with a python script.

Applications can also be created from directories. The directory should contain a main.py (and any other helper modules that are required) as well as any additional assets (e.g., theme files). Pass the directory name to bokeh svg to generate the SVG:

bokeh svg app_dir

It is possible to generate SVG files for multiple applications at once:

bokeh svg app_script.py app_dir

For all cases, it’s required to explicitly add a Bokeh layout to bokeh.io.curdoc for it to appear in the output.

class SVG(parser)[source]

Subcommand to output applications as standalone SVG files.

file_contents(args, doc)[source]
invoke(args)[source]
write_file(args, filename, doc)[source]
extension = 'svg'

file extension for output generated by this FileOutputSubcommand

name = 'svg'

name for this subcommand