@@ -142,7 +142,7 @@ It is useful to strive for consistency in the Matplotlib documentation. Here
142
142
are some formatting and style conventions that are used.
143
143
144
144
Section formatting
145
- ~~~~~~~~~~~~~~~~~~
145
+ ^^^^^^^^^^^^^^^^^^
146
146
147
147
Use `sentence case <https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case >`__
148
148
``Upper lower `` for section titles, e.g., ``Possible hangups `` rather than
@@ -163,8 +163,25 @@ for section markup characters, i.e.:
163
163
164
164
This may not yet be applied consistently in existing docs.
165
165
166
+ Table formatting
167
+ ^^^^^^^^^^^^^^^^
168
+ Given the size of the table and length of each entry, use:
169
+
170
+ +-------------+-------------------------------+--------------------+
171
+ | | small table | large table |
172
+ +-------------+-------------------------------+--------------------+
173
+ | short entry | `simple or grid table <sg >`_ | `grid table <sg >`_ |
174
+ +-------------+-------------------------------+--------------------+
175
+ | long entry | `list table <lt >`_ | `csv table <csv >`_ |
176
+ +-------------+-------------------------------+--------------------+
177
+
178
+ For more information, see `rst tables <https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#tables >`_.
179
+ .. _sg : https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#tables
180
+ .. _lt : https://docutils.sourceforge.io/docs/ref/rst/directives.html#list-table
181
+ .. _csv : https://docutils.sourceforge.io/docs/ref/rst/directives.html#toc-entry-22
182
+
166
183
Function arguments
167
- ~~~~~~~~~~~~~~~~~~
184
+ ^^^^^^^^^^^^^^^^^^
168
185
169
186
Function arguments and keywords within docstrings should be referred to using
170
187
the ``*emphasis* `` role. This will keep Matplotlib's documentation consistent
@@ -445,7 +462,8 @@ and the Sphinx_ documentation. Some Matplotlib-specific formatting conventions
445
462
to keep in mind:
446
463
447
464
Quote positions
448
- ~~~~~~~~~~~~~~~
465
+ ^^^^^^^^^^^^^^^
466
+
449
467
The quotes for single line docstrings are on the same line (pydocstyle D200)::
450
468
451
469
def get_linewidth(self):
@@ -461,7 +479,8 @@ The quotes for multi-line docstrings are on separate lines (pydocstyle D213)::
461
479
"""
462
480
463
481
Function arguments
464
- ~~~~~~~~~~~~~~~~~~
482
+ ^^^^^^^^^^^^^^^^^^
483
+
465
484
Function arguments and keywords within docstrings should be referred to
466
485
using the ``*emphasis* `` role. This will keep Matplotlib's documentation
467
486
consistent with Python's documentation:
@@ -478,7 +497,8 @@ Do not use the ```default role``` or the ````literal```` role:
478
497
479
498
480
499
Quotes for strings
481
- ~~~~~~~~~~~~~~~~~~
500
+ ^^^^^^^^^^^^^^^^^^
501
+
482
502
Matplotlib does not have a convention whether to use single-quotes or
483
503
double-quotes. There is a mixture of both in the current code.
484
504
@@ -495,7 +515,8 @@ slightly improve the rendered docs, they are cumbersome to type and difficult
495
515
to read in plain-text docs.
496
516
497
517
Parameter type descriptions
498
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
518
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
519
+
499
520
The main goal for parameter type descriptions is to be readable and
500
521
understandable by humans. If the possible types are too complex use a
501
522
simplification for the type description and explain the type more
@@ -534,7 +555,8 @@ Non-numeric homogeneous sequences are described as lists, e.g.::
534
555
list of `.Artist`
535
556
536
557
Reference types
537
- ~~~~~~~~~~~~~~~
558
+ ^^^^^^^^^^^^^^^
559
+
538
560
Generally, the rules from referring-to-other-code _ apply. More specifically:
539
561
540
562
Use full references ```~matplotlib.colors.Normalize` `` with an
@@ -550,7 +572,8 @@ Use abbreviated links ```.Normalize``` in the text.
550
572
A `.Normalize` instance is used to scale luminance data to 0, 1.
551
573
552
574
Default values
553
- ~~~~~~~~~~~~~~
575
+ ^^^^^^^^^^^^^^
576
+
554
577
As opposed to the numpydoc guide, parameters need not be marked as
555
578
*optional * if they have a simple default:
556
579
@@ -592,7 +615,8 @@ effect.
592
615
593
616
594
617
``See also `` sections
595
- ~~~~~~~~~~~~~~~~~~~~~
618
+ ^^^^^^^^^^^^^^^^^^^^^
619
+
596
620
Sphinx automatically links code elements in the definition blocks of ``See
597
621
also `` sections. No need to use backticks there::
598
622
@@ -602,7 +626,8 @@ also`` sections. No need to use backticks there::
602
626
axhline : horizontal line across the Axes
603
627
604
628
Wrap parameter lists
605
- ~~~~~~~~~~~~~~~~~~~~
629
+ ^^^^^^^^^^^^^^^^^^^^
630
+
606
631
Long parameter lists should be wrapped using a ``\ `` for continuation and
607
632
starting on the new line without any indent (no indent because pydoc will
608
633
parse the docstring and strip the line continuation so that indent would
@@ -627,7 +652,8 @@ Alternatively, you can describe the valid parameter values in a dedicated
627
652
section of the docstring.
628
653
629
654
rcParams
630
- ~~~~~~~~
655
+ ^^^^^^^^
656
+
631
657
rcParams can be referenced with the custom ``:rc: `` role:
632
658
:literal: `:rc:\` foo\` ` yields ``rcParams["foo"] = 'default' ``, which is a link
633
659
to the :file: `matplotlibrc ` file description.
0 commit comments