@@ -177,6 +177,47 @@ calls in `matplotlib.patches`.
177
177
Formatting
178
178
==========
179
179
180
+ All new or edited docstrings should conform to the numpydoc guidelines. These
181
+ split the docstring down into a number of sections - see
182
+ https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt for more
183
+ details and a guide to the way docstrings should be written. A simple example
184
+ docstring looks like:
185
+ .. code-block :: python
186
+
187
+ def hlines (self , y , xmin , xmax , colors = ' k' , linestyles = ' solid' ,
188
+ label = ' ' , ** kwargs ):
189
+ """
190
+ Plot horizontal lines at each `y` from `xmin` to `xmax`.
191
+
192
+ Parameters
193
+ ----------
194
+ y : scalar or sequence of scalar
195
+ y-indexes where to plot the lines.
196
+
197
+ xmin, xmax : scalar or 1D array_like
198
+ Respective beginning and end of each line. If scalars are
199
+ provided, all lines will have same length.
200
+
201
+ colors : array_like of colors, optional, default: 'k'
202
+
203
+ linestyles : ['solid' | 'dashed' | 'dashdot' | 'dotted'], optional
204
+
205
+ label : string, optional, default: ''
206
+
207
+ Returns
208
+ -------
209
+ lines : `~matplotlib.collections.LineCollection`
210
+
211
+ Other Parameters
212
+ ----------------
213
+ **kwargs : `~matplotlib.collections.LineCollection` properties.
214
+
215
+ See also
216
+ --------
217
+ vlines : vertical lines
218
+ axhline: horizontal line across the axes
219
+ """
220
+
180
221
The Sphinx website contains plenty of documentation _ concerning ReST markup and
181
222
working with Sphinx in general. Here are a few additional things to keep in mind:
182
223
@@ -185,9 +226,11 @@ working with Sphinx in general. Here are a few additional things to keep in mind
185
226
markup `_. For example, when referring to external files, the
186
227
``:file: `` directive should be used.
187
228
188
- * Function arguments and keywords should be referred to using the
189
- ``*emphasis* `` role. This will keep Matplotlib's documentation consistent
190
- with Python's documentation:
229
+ Function arguments
230
+ ------------------
231
+ Function arguments and keywords should be referred to using the
232
+ ``*emphasis* `` role. This will keep Matplotlib's documentation consistent
233
+ with Python's documentation:
191
234
192
235
.. code-block :: rst
193
236
@@ -206,8 +249,10 @@ working with Sphinx in general. Here are a few additional things to keep in mind
206
249
207
250
Please do not describe ``argument`` like this.
208
251
209
- * Mathematical expressions can be rendered as png images in html, and in the
210
- usual way by LaTeX. For example,
252
+ Maths
253
+ -----
254
+ Mathematical expressions can be rendered as png images in html, and in the
255
+ usual way by LaTeX. For example,
211
256
212
257
.. code-block :: rst
213
258
@@ -223,8 +268,10 @@ working with Sphinx in general. Here are a few additional things to keep in mind
223
268
224
269
yields :math: `\int _{-\infty }^{\infty }\frac {e^{i\phi }}{1 +x^2 \frac {e^{i\phi }}{1 +x^2 }}`.
225
270
226
- * Interactive IPython sessions can be illustrated in the documentation using
227
- the following directive:
271
+ IPython code
272
+ -----------
273
+ Interactive IPython sessions can be illustrated in the documentation using
274
+ the following directive:
228
275
229
276
.. code-block :: rst
230
277
@@ -238,84 +285,24 @@ working with Sphinx in general. Here are a few additional things to keep in mind
238
285
239
286
In [69]: lines = plot([1,2,3])
240
287
241
- * Footnotes [# ]_ can be added using ``[#]_ ``, followed later by:
288
+ Footnotes
289
+ ---------
290
+ Footnotes [# ]_ can be added using ``[#]_ ``, followed later by:
242
291
243
292
.. code-block :: rst
244
293
245
294
.. rubric:: Footnotes
246
295
247
296
.. [#]
248
297
249
- which yields
298
+ which yields
250
299
251
300
.. rubric :: Footnotes
252
301
253
302
.. [# ] For example.
254
303
255
- * Use the *note * and *warning * directives, sparingly, to draw attention to
256
- important comments:
257
-
258
- .. code-block :: rst
259
-
260
- .. note::
261
- Here is a note.
262
-
263
- .. warning::
264
- Here is a warning.
265
-
266
- yields:
267
-
268
- .. note ::
269
- Here is a note.
270
-
271
- .. warning ::
272
- Here is a warning.
273
-
274
- * Use the *deprecated * directive when appropriate:
275
-
276
- .. code-block :: rst
277
-
278
- .. deprecated:: 0.98
279
- This feature is obsolete, use something else.
280
-
281
- yields:
282
-
283
- .. deprecated :: 0.98
284
- This feature is obsolete, use something else.
285
-
286
- * Use the *versionadded * and *versionchanged * directives, which have similar
287
- syntax to the *deprecated * role:
288
-
289
- .. code-block :: rst
290
-
291
- .. versionadded:: 0.98
292
- The transforms have been completely revamped.
293
-
294
- .. versionadded :: 0.98
295
- The transforms have been completely revamped.
296
-
297
- * Use the *seealso * directive, for example:
298
-
299
- .. code-block :: rst
300
-
301
- .. seealso::
302
-
303
- Using ReST :ref:`emacs-helpers`:
304
- One example
305
-
306
- A bit about :ref:`referring-to-mpl-docs`:
307
- One more
308
-
309
- yields:
310
-
311
- .. seealso ::
312
-
313
- Using ResT :ref: `emacs-helpers `:
314
- One example
315
-
316
- A bit about :ref: `referring-to-mpl-docs `:
317
- One more
318
-
304
+ Other
305
+ -----
319
306
* Please keep the :ref: `glossary ` in mind when writing documentation. You can
320
307
create a references to a term in the glossary with the ``:term: `` role.
321
308
0 commit comments