8000 Merge pull request #14539 from anntzer/sphinxextindent · matplotlib/matplotlib@1eaf40f · GitHub
[go: up one dir, main page]

Skip to content

Commit 1eaf40f

Browse files
authored
Merge pull request #14539 from anntzer/sphinxextindent
Don't overindent enumerated list in plot_directive docstring.
2 parents c703178 + 5bcbe2b commit 1eaf40f

File tree

1 file changed

+41
-47
lines changed

1 file changed

+41
-47
lines changed

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 41 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
11
"""
22
A directive for including a matplotlib plot in a Sphinx document.
33
4-
By default, in HTML output, `plot` will include a .png file with a
5-
link to a high-res .png and .pdf. In LaTeX output, it will include a
6-
.pdf.
4+
By default, in HTML output, `plot` will include a .png file with a link to a
5+
high-res .png and .pdf. In LaTeX output, it will include a .pdf.
76
87
The source code for the plot may be included in one of three ways:
98
10-
1. **A path to a source file** as the argument to the directive::
9+
1. **A path to a source file** as the argument to the directive::
1110
12-
.. plot:: path/to/plot.py
11+
.. plot:: path/to/plot.py
1312
14-
When a path to a source file is given, the content of the
15-
directive may optionally contain a caption for the plot::
13+
When a path to a source file is given, the content of the
14+
directive may optionally contain a caption for the plot::
1615
17-
.. plot:: path/to/plot.py
16+
.. plot:: path/to/plot.py
1817
19-
This is the caption for the plot
18+
This is the caption for the plot
2019
21-
Additionally, one may specify the name of a function to call (with
22-
no arguments) immediately after importing the module::
20+
Additionally, one may specify the name of a function to call (with
21+
no arguments) immediately after importing the module::
2322
24-
.. plot:: path/to/plot.py plot_function1
23+
.. plot:: path/to/plot.py plot_function1
2524
26-
2. Included as **inline content** to the directive::
25+
2. Included as **inline content** to the directive::
2726
28-
.. plot::
27+
.. plot::
2928
30-
import matplotlib.pyplot as plt
31-
import matplotlib.image as mpimg
32-
import numpy as np
33-
img = mpimg.imread('_static/stinkbug.png')
34-
imgplot = plt.imshow(img)
29+
import matplotlib.pyplot as plt
30+
import matplotlib.image as mpimg
31+
import numpy as np
32+
img = mpimg.imread('_static/stinkbug.png')
33+
imgplot = plt.imshow(img)
3534
36-
3. Using **doctest** syntax::
35+
3. Using **doctest** syntax::
3736
38-
.. plot::
39-
A plotting example:
40-
>>> import matplotlib.pyplot as plt
41-
>>> plt.plot([1,2,3], [4,5,6])
37+
.. plot::
38+
A plotting example:
39+
>>> import matplotlib.pyplot as plt
40+
>>> plt.plot([1,2,3], [4,5,6])
4241
4342
Options
4443
-------
@@ -53,30 +52,26 @@
5352
using the `plot_include_source` variable in conf.py
5453
5554
encoding : str
56-
If this source file is in a non-UTF8 or non-ASCII encoding,
57-
the encoding must be specified using the `:encoding:` option.
58-
The encoding will not be inferred using the ``-*- coding -*-``
59-
metacomment.
55+
If this source file is in a non-UTF8 or non-ASCII encoding, the
56+
encoding must be specified using the `:encoding:` option. The encoding
57+
will not be inferred using the ``-*- coding -*-`` metacomment.
6058
6159
context : bool or str
62-
If provided, the code will be run in the context of all
63-
previous plot directives for which the `:context:` option was
64-
specified. This only applies to inline code plot directives,
65-
not those run from files. If the ``:context: reset`` option is
66-
specified, the context is reset for this and future plots, and
67-
previous figures are closed prior to running the code.
68-
``:context:close-figs`` keeps the context but closes previous figures
69-
before running the code.
60+
If provided, the code will be run in the context of all previous plot
61+
directives for which the `:context:` option was specified. This only
62+
applies to inline code plot directives, not those run from files. If
63+
the ``:context: reset`` option is specified, the context is reset
64+
for this and future plots, and previous figures are closed prior to
65+
running the code. ``:context: close-figs`` keeps the context but closes
66+
previous figures before running the code.
7067
7168
nofigs : bool
72-
If specified, the code block will be run, but no figures will
73-
be inserted. This is usually useful with the ``:context:``
74-
option.
69+
If specified, the code block will be run, but no figures will be
70+
inserted. This is usually useful with the ``:context:`` option.
7571
76-
Additionally, this directive supports all of the options of the
77-
`image` directive, except for `target` (since plot will add its own
78-
target). These include `alt`, `height`, `width`, `scale`, `align` and
79-
`class`.
72+
Additionally, this directive supports all of the options of the `image`
73+
directive, except for `target` (since plot will add its own target). These
74+
include `alt`, `height`, `width`, `scale`, `align` and `class`.
8075
8176
Configuration options
8277
---------------------
@@ -109,7 +104,7 @@
109104
that determine the file format and the DPI. For entries whose
110105
DPI was omitted, sensible defaults are chosen. When passing from
111106
the command line through sphinx_build the list should be passed as
112-
suffix:dpi,suffix:dpi, ....
107+
suffix:dpi,suffix:dpi, ...
113108
114109
plot_html_show_formats
115110
Whether to show links to the files in HTML.
@@ -213,9 +208,8 @@ def _option_align(arg):
213208

214209
def mark_plot_labels(app, document):
215210
"""
216-
To make plots referenceable, we need to move the reference from
217-
the "htmlonly" (or "latexonly") node to the actual figure node
218-
itself.
211+
To make plots referenceable, we need to move the reference from the
212+
"htmlonly" (or "latexonly") node to the actual figure node itself.
219213
"""
220214
for name, explicit in document.nametypes.items():
221215
if not explicit:

0 commit comments

Comments
 (0)
0