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

Skip to content

Commit cfe5bf7

Browse files
authored
Merge pull request #26754 from story645/axisartist-table
DOC: seperate and clarify axisartist default tables
2 parents 875232e + be1c941 commit cfe5bf7

File tree

2 files changed

+68
-23
lines changed

2 files changed

+68
-23
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.

galleries/users_explain/toolkits/axisartist.rst

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -341,18 +341,37 @@ On the other hand, there is a concept of "axis_direction". This is a
341341
default setting of above properties for each, "bottom", "left", "top",
342342
and "right" axis.
343343

344-
========== ========== ========= ========== ========= ==========
345-
label type parameter left bottom right top
346-
========== ========== ========= ========== ========= ==========
347-
axislabel direction '-' '+' '+' '-'
348-
axislabel rotation 180 0 0 180
349-
axislabel va center top center bottom
350-
axislabel ha right center right center
351-
ticklabel direction '-' '+' '+' '-'
352-
ticklabel rotation 90 0 -90 180
353-
ticklabel ha right center right center
354-
ticklabel va center baseline center baseline
355-
========== ========== ========= ========== ========= ==========
344+
.. table:: ``axislabel`` property defaults
345+
346+
+---------------------+-----------------+----------------+----------------------+--------------------+
347+
| reference direction | label direction | label rotation | horizontal alignment | vertical alignment |
348+
+=====================+=================+================+======================+====================+
349+
| left | '-' | 180 | right | center |
350+
+---------------------+-----------------+----------------+----------------------+--------------------+
351+
| bottom | '+' | 0 | center | top |
352+
+---------------------+-----------------+----------------+----------------------+--------------------+
353+
| right | '+' | 0 | right | center |
354+
+---------------------+-----------------+----------------+----------------------+--------------------+
355+
| top | '-' | 180 | center | bottom |
356+
+---------------------+-----------------+----------------+----------------------+--------------------+
357+
358+
359+
360+
.. table:: ``ticklabel`` property defaults
361+
362+
+---------------------+-----------------+----------------+----------------------+--------------------+
363+
| reference direction | label direction | label rotation | horizontal alignment | vertical alignment |
364+
+=====================+=================+================+======================+====================+
365+
| left | '-' | 90 | right | center |
366+
+---------------------+-----------------+----------------+----------------------+--------------------+
367+
| bottom | '+' | 0 | center | baseline |
368+
+---------------------+-----------------+----------------+----------------------+--------------------+
369+
| right | '+' | -90 | right | center |
370+
+---------------------+-----------------+----------------+----------------------+--------------------+
371+
| top | '-' | 180 | center | baseline |
372+
+---------------------+-----------------+----------------+----------------------+--------------------+
373+
374+
356375

357376
And, 'set_axis_direction("top")' means to adjust the text rotation
358377
etc, for settings suitable for "top" axis. The concept of axis

0 commit comments

Comments
 (0)