@@ -562,44 +562,55 @@ By convention, these setters and getters are named ``set_PROPERTYNAME`` and
562562``get_PROPERTYNAME ``; the list of properties thusly defined on an artist and
563563their values can be listed by the `~.pyplot.setp ` and `~.pyplot.getp ` functions.
564564
565- .. note ::
566-
567- ``ACCEPTS `` blocks have recently become optional. You may now use a
568- numpydoc ``Parameters `` block because the accepted values can now be read
569- from the type description of the first parameter.
570-
571- Property setter methods should indicate the values they accept using a (legacy)
572- special block in the docstring, starting with ``ACCEPTS ``, as follows:
565+ The Parameters block of property setter methods is parsed to document the
566+ accepted values, e.g. the docstring of `.Line2D.set_linestyle ` starts with
573567
574568.. code-block :: python
575569
576- # in lines.py
577- def set_linestyle (self , linestyle ):
570+ def set_linestyle (self , ls ):
578571 """
579- Set the linestyle of the line
572+ Set the linestyle of the line.
580573
581- ACCEPTS: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' | ' ' | '' ]
574+ Parameters
575+ ----------
576+ ls : {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
577+ etc.
582578 """
583579
584- The ACCEPTS block is used to render a table of all properties and their
585- acceptable values in the docs; it can also be displayed using, e.g.,
586- `` plt.setp(Line2D) `` (all properties) or `` plt.setp(Line2D, 'linestyle') ``
587- (just one property).
580+ which results in the following line in the output of `` plt.setp(line) `` or
581+ `` plt.setp(line, "linestyle") ``::
582+
583+ linestyle or ls: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
588584
589- There are cases in which the ACCEPTS string is not useful in the
590- generated Sphinx documentation, e.g. if the valid parameters are already
591- defined in the numpydoc parameter list. You can hide the ACCEPTS string from
592- Sphinx by making it a ReST comment (i.e. use `` .. ACCEPTS: ``) :
585+ In some rare cases (mostly, setters which accept both a single tuple and an
586+ unpacked tuple), the accepted values cannot be documented in such a fashion;
587+ in that case, they can be documented as an `` .. ACCEPTS: `` block, e.g. for
588+ ` .axes.Axes.set_xlim ` :
593589
594590.. code-block :: python
595591
596- def set_linestyle (self , linestyle ):
592+ def set_xlim (self , ... ):
597593 """
598- An ACCEPTS string invisible to Sphinx.
594+ Set the x-axis view limits.
595+
596+ Parameters
597+ ----------
598+ left : float, optional
599+ The left xlim in data coordinates. Passing *None* leaves the
600+ limit unchanged.
601+
602+ The left and right xlims may also be passed as the tuple
603+ (*left*, *right*) as the first positional argument (or as
604+ the *left* keyword argument).
605+
606+ .. ACCEPTS: (bottom: float, top: float)
599607
600- .. ACCEPTS: [ '-' | '--' | '-.' | ':' | 'steps' | 'None' | ' ' | '' ]
608+ right : float, optional
609+ etc.
601610 """
602611
612+ Note that the leading ``.. `` makes the ``.. ACCEPTS: `` block a reST comment,
613+ hiding it from the rendered docs.
603614
604615Keyword arguments
605616-----------------
0 commit comments