Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DOC: document how to created interpolated stubs#28746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
story645 wants to merge2 commits intomatplotlib:main
base:main
Choose a base branch
Loading
fromstory645:interp-doc
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletionsdoc/devel/document.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -730,13 +730,6 @@ hiding it from the rendered docs.
Keyword arguments
-----------------

.. note::

The information in this section is being actively discussed by the
development team, so use the docstring interpolation only if necessary.
This section has been left in place for now because this interpolation
is part of the existing documentation.

Since Matplotlib uses a lot of pass-through ``kwargs``, e.g., in every function
that creates a line (`~.pyplot.plot`, `~.pyplot.semilogx`, `~.pyplot.semilogy`,
etc.), it can be difficult for the new user to know which ``kwargs`` are
Expand DownExpand Up@@ -797,6 +790,35 @@ point, `.kwdoc` can list the properties and interpolate them into
``__init__.__doc__``.


Create interpolated stubs
^^^^^^^^^^^^^^^^^^^^^^^^^

If you are contributing code that will require keyword argument forwarding or creating
an object that may be returned in many places, such as the `.Line2D` artist, then you
may want to create docstrings that can be interpolated. To add documentation to the
``interpd`` lookup, add an identifier and the associated docstring:

.. code-block:: python

from matplotlib import _docstring

_docstring.interpd.update(new_artist_doc="creates smiley faces")

This now allows the string to be used in any docstring. For example:

.. code-block:: python

def plot(self, *args, **kwargs):
"""
**kwargs : new artist properties, optional
%(new_artist_doc)s
"""


The list of interpolated stubs is stored in the ``_docstring.interpd.params``
dictionary.


Inherit docstrings
------------------

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp