Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 53795d5

Browse files
committed
document table usage and clean up headings
1 parent 4f9697f commit 53795d5

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

doc/devel/document.rst

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ It is useful to strive for consistency in the Matplotlib documentation. Here
142142
are some formatting and style conventions that are used.
143143

144144
Section formatting
145-
~~~~~~~~~~~~~~~~~~
145+
^^^^^^^^^^^^^^^^^^
146146

147147
Use `sentence case <https://apastyle.apa.org/style-grammar-guidelines/capitalization/sentence-case>`__
148148
``Upper lower`` for section titles, e.g., ``Possible hangups`` rather than
@@ -163,8 +163,25 @@ for section markup characters, i.e.:
163163

164164
This may not yet be applied consistently in existing docs.
165165

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+
166183
Function arguments
167-
~~~~~~~~~~~~~~~~~~
184+
^^^^^^^^^^^^^^^^^^
168185

169186
Function arguments and keywords within docstrings should be referred to using
170187
the ``*emphasis*`` role. This will keep Matplotlib's documentation consistent
@@ -445,7 +462,8 @@ and the Sphinx_ documentation. Some Matplotlib-specific formatting conventions
445462
to keep in mind:
446463

447464
Quote positions
448-
~~~~~~~~~~~~~~~
465+
^^^^^^^^^^^^^^^
466+
449467
The quotes for single line docstrings are on the same line (pydocstyle D200)::
450468

451469
def get_linewidth(self):
@@ -461,7 +479,8 @@ The quotes for multi-line docstrings are on separate lines (pydocstyle D213)::
461479
"""
462480

463481
Function arguments
464-
~~~~~~~~~~~~~~~~~~
482+
^^^^^^^^^^^^^^^^^^
483+
465484
Function arguments and keywords within docstrings should be referred to
466485
using the ``*emphasis*`` role. This will keep Matplotlib's documentation
467486
consistent with Python's documentation:
@@ -478,7 +497,8 @@ Do not use the ```default role``` or the ````literal```` role:
478497
479498
480499
Quotes for strings
481-
~~~~~~~~~~~~~~~~~~
500+
^^^^^^^^^^^^^^^^^^
501+
482502
Matplotlib does not have a convention whether to use single-quotes or
483503
double-quotes. There is a mixture of both in the current code.
484504

@@ -495,7 +515,8 @@ slightly improve the rendered docs, they are cumbersome to type and difficult
495515
to read in plain-text docs.
496516

497517
Parameter type descriptions
498-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
518+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
519+
499520
The main goal for parameter type descriptions is to be readable and
500521
understandable by humans. If the possible types are too complex use a
501522
simplification for the type description and explain the type more
@@ -534,7 +555,8 @@ Non-numeric homogeneous sequences are described as lists, e.g.::
534555
list of `.Artist`
535556

536557
Reference types
537-
~~~~~~~~~~~~~~~
558+
^^^^^^^^^^^^^^^
559+
538560
Generally, the rules from referring-to-other-code_ apply. More specifically:
539561

540562
Use full references ```~matplotlib.colors.Normalize``` with an
@@ -550,7 +572,8 @@ Use abbreviated links ```.Normalize``` in the text.
550572
A `.Normalize` instance is used to scale luminance data to 0, 1.
551573
552574
Default values
553-
~~~~~~~~~~~~~~
575+
^^^^^^^^^^^^^^
576+
554577
As opposed to the numpydoc guide, parameters need not be marked as
555578
*optional* if they have a simple default:
556579

@@ -592,7 +615,8 @@ effect.
592615
593616
594617
``See also`` sections
595-
~~~~~~~~~~~~~~~~~~~~~
618+
^^^^^^^^^^^^^^^^^^^^^
619+
596620
Sphinx automatically links code elements in the definition blocks of ``See
597621
also`` sections. No need to use backticks there::
598622

@@ -602,7 +626,8 @@ also`` sections. No need to use backticks there::
602626
axhline : horizontal line across the Axes
603627

604628
Wrap parameter lists
605-
~~~~~~~~~~~~~~~~~~~~
629+
^^^^^^^^^^^^^^^^^^^^
630+
606631
Long parameter lists should be wrapped using a ``\`` for continuation and
607632
starting on the new line without any indent (no indent because pydoc will
608633
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
627652
section of the docstring.
628653

629654
rcParams
630-
~~~~~~~~
655+
^^^^^^^^
656+
631657
rcParams can be referenced with the custom ``:rc:`` role:
632658
:literal:`:rc:\`foo\`` yields ``rcParams["foo"] = 'default'``, which is a link
633659
to the :file:`matplotlibrc` file description.

0 commit comments

Comments
 (0)