module sphinxext.bokeh.bokeh_plot
¶
Short summary¶
module pyquickhelper.sphinxext.bokeh.bokeh_plot
Modified version of bokeh_plot.py, LICENSE.
Include bokeh plots in Sphinx HTML documentation.
For other output types, the placeholder text [graph]
will
be generated.
The bokeh-plot
directive can be used by either supplying,
a path to a source file as the argument to the directive:
.. bokeh-plot:: path/to/plot.py
Classes¶
class |
truncated documentation |
---|---|
Functions¶
function |
truncated documentation |
---|---|
|
|
|
|
Required Sphinx extension setup function. |
Methods¶
method |
truncated documentation |
---|---|
|
Documentation¶
Modified version of bokeh_plot.py, LICENSE.
Include bokeh plots in Sphinx HTML documentation.
For other output types, the placeholder text [graph]
will
be generated.
The bokeh-plot
directive can be used by either supplying,
a path to a source file as the argument to the directive:
.. bokeh-plot:: path/to/plot.py
Note
.py scripts are not scanned automatically! In order to include certain directories into .py scanning process use following directive in sphinx conf.py file: bokeh_plot_pyfile_include_dirs = [“dir1”,”dir2”]
Inline code as the content of the directive:
.. bokeh-plot::
from bokeh.plotting import figure, output_file, show
output_file("example.html")
x = [1, 2, 3, 4, 5]
y = [6, 7, 6, 4, 5]
p = figure(title="example", plot_width=300, plot_height=300)
p.line(x, y, line_width=2)
p.circle(x, y, size=10, fill_color="white")
show(p)
This directive also works in conjunction with Sphinx autodoc, when used in docstrings.
The bokeh-plot
directive accepts the following options:
- source-position (enum(‘above’, ‘below’, ‘none’)):
Where to locate the the block of formatted source code (if anywhere).
- linenos (bool):
Whether to display line numbers along with the source.
Examples¶
The inline example code above produces the following output:
from bokeh.plotting import figure, output_file, show
output_file("example.html")
x = [1, 2, 3, 4, 5]
y = [6, 7, 6, 4, 5]
p = figure(title="example", plot_width=300, plot_height=300)
p.line(x, y, line_width=2)
p.circle(x, y, size=10, fill_color="white")
show(p)
- class pyquickhelper.sphinxext.bokeh.bokeh_plot.BokehPlotDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]¶
Bases:
Directive
- pyquickhelper.sphinxext.bokeh.bokeh_plot._process_script(source, filename, env, js_name, use_relative_paths=False)[source]¶