@@ -86,21 +86,23 @@ function that takes a ``**kwargs``. The requirements are:
86862. as automated as possible so that as properties change, the docs
8787 are updated automagically.
8888
89- The functions :attr : `matplotlib.artist.kwdocd ` and
90- :func: `matplotlib.artist.kwdoc ` to facilitate this. They combine
89+ The function :func : `matplotlib.artist.kwdoc ` and the decorator
90+ :func: `matplotlib.docstring.dedent_interpd ` facilitate this. They combine
9191python string interpolation in the docstring with the matplotlib
9292artist introspection facility that underlies ``setp `` and ``getp ``.
93- The ``kwdocd `` is a single dictionary that maps class name to a
94- docstring of ``kwargs ``. Here is an example from
93+ The ``kwdoc `` function gives the list of properties as a docstring. In order
94+ to use this in another docstring, first update the
95+ ``matplotlib.docstring.interpd `` object, as seen in this example from
9596:mod: `matplotlib.lines `::
9697
9798 # in lines.py
98- artist.kwdocd[' Line2D'] = artist.kwdoc(Line2D)
99+ docstring.interpd.update( Line2D= artist.kwdoc(Line2D) )
99100
100101Then in any function accepting :class: `~matplotlib.lines.Line2D `
101102pass-through ``kwargs ``, e.g., :meth: `matplotlib.axes.Axes.plot `::
102103
103104 # in axes.py
105+ @docstring.dedent_interpd
104106 def plot(self, *args, **kwargs):
105107 """
106108 Some stuff omitted
@@ -114,7 +116,6 @@ pass-through ``kwargs``, e.g., :meth:`matplotlib.axes.Axes.plot`::
114116 information
115117 """
116118 pass
117- plot.__doc__ = cbook.dedent(plot.__doc__) % artist.kwdocd
118119
119120Note there is a problem for :class: `~matplotlib.artist.Artist `
120121``__init__ `` methods, e.g., :meth: `matplotlib.patches.Patch.__init__ `,
@@ -123,7 +124,7 @@ work until the class is fully defined and we can't modify the
123124``Patch.__init__.__doc__ `` docstring outside the class definition.
124125There are some some manual hacks in this case, violating the
125126"single entry point" requirement above -- see the
126- ``artist.kwdocd['Patch'] `` setting in :mod: `matplotlib.patches `.
127+ ``docstring.interpd.update `` calls in :mod: `matplotlib.patches `.
127128
128129.. _formatting-mpl-docs :
129130
0 commit comments