@@ -86,21 +86,23 @@ function that takes a ``**kwargs``. The requirements are:
86
86
2. as automated as possible so that as properties change, the docs
87
87
are updated automagically.
88
88
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
91
91
python string interpolation in the docstring with the matplotlib
92
92
artist 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
95
96
:mod: `matplotlib.lines `::
96
97
97
98
# in lines.py
98
- artist.kwdocd[' Line2D'] = artist.kwdoc(Line2D)
99
+ docstring.interpd.update( Line2D= artist.kwdoc(Line2D) )
99
100
100
101
Then in any function accepting :class: `~matplotlib.lines.Line2D `
101
102
pass-through ``kwargs ``, e.g., :meth: `matplotlib.axes.Axes.plot `::
102
103
103
104
# in axes.py
105
+ @docstring.dedent_interpd
104
106
def plot(self, *args, **kwargs):
105
107
"""
106
108
Some stuff omitted
@@ -114,7 +116,6 @@ pass-through ``kwargs``, e.g., :meth:`matplotlib.axes.Axes.plot`::
114
116
information
115
117
"""
116
118
pass
117
- plot.__doc__ = cbook.dedent(plot.__doc__) % artist.kwdocd
118
119
119
120
Note there is a problem for :class: `~matplotlib.artist.Artist `
120
121
``__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
123
124
``Patch.__init__.__doc__ `` docstring outside the class definition.
124
125
There are some some manual hacks in this case, violating the
125
126
"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 `.
127
128
128
129
.. _formatting-mpl-docs :
129
130
0 commit comments