scipp.sphinxext.autoplot#
Sphinx extension to automatically place plot directives.
Places matplotlib plot directives
for doctest code blocks (starting with >>>
) in docstrings when those
code blocks create plots.
Plots are detected by matching a pattern against the source code in code blocks.
This means that either sc.plot
or any of the corresponding bound methods must be
called directly in the code block.
It does not work if plot
is called by another function.
It does however work with any function called ‘plot’.
It is possible to use the plot directive manually.
autoplot
will detect that and not place an additional directive.
This is useful, e.g., for specifying options to the directive.
Simple Example#
autoplot
turns
>>> sc.arange('x',5).plot()
into
.. plot::
>>> sc.arange('x',5).plot()
Disabling autoplot#
autoplot
can be disabled by using the .. autoplot-disable::
directive
anywhere (on its own line) in a docstring.
This will disable autoplot for the entire docstring.