Skip to content

Clean docstring of CountourSet #11090

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 22, 2018
Merged
Changes from all 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
77 changes: 37 additions & 40 deletions lib/matplotlib/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,42 @@ class ContourSet(cm.ScalarMappable, ContourLabeler):
"""
Store a set of contour lines or filled regions.

User-callable method: clabel
User-callable method: `~.Axes.clabel`

Parameters
----------
ax : `~.axes.Axes`

levels : [level0, level1, ..., leveln]
A list of floating point numbers indicating the contour
levels.

allsegs : [level0segs, level1segs, ...]
List of all the polygon segments for all the *levels*.
For contour lines ``len(allsegs) == len(levels)``, and for
filled contour regions ``len(allsegs) = len(levels)-1``. The lists
should look like::

level0segs = [polygon0, polygon1, ...]
polygon0 = array_like [[x0,y0], [x1,y1], ...]

allkinds : ``None`` or [level0kinds, level1kinds, ...]
Optional list of all the polygon vertex kinds (code types), as
described and used in Path. This is used to allow multiply-
connected paths such as holes within filled polygons.
If not ``None``, ``len(allkinds) == len(allsegs)``. The lists
should look like::

level0kinds = [polygon0kinds, ...]
polygon0kinds = [vertexcode0, vertexcode1, ...]

If *allkinds* is not ``None``, usually all polygons for a
particular contour level are grouped together so that
``level0segs = [polygon0]`` and ``level0kinds = [polygon0kinds]``.

kwargs :
Keyword arguments are as described in the docstring of
`~.Axes.contour`.

Attributes
----------
Expand All @@ -757,44 +792,6 @@ class ContourSet(cm.ScalarMappable, ContourLabeler):
"""

def __init__(self, ax, *args, **kwargs):
"""
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numpydoc says to put the parameters section in the class docstring (not the __init__ docstring, before the attributes doc, which I think makes sense, and makes everything look a bit more sensible.

Draw contour lines or filled regions, depending on
whether keyword arg *filled* is ``False`` (default) or ``True``.

The first three arguments must be:

*ax*: axes object.

*levels*: [level0, level1, ..., leveln]
A list of floating point numbers indicating the contour
levels.

*allsegs*: [level0segs, level1segs, ...]
List of all the polygon segments for all the *levels*.
For contour lines ``len(allsegs) == len(levels)``, and for
filled contour regions ``len(allsegs) = len(levels)-1``. The lists
should look like::

level0segs = [polygon0, polygon1, ...]
polygon0 = array_like [[x0,y0], [x1,y1], ...]

*allkinds*: *None* or [level0kinds, level1kinds, ...]
Optional list of all the polygon vertex kinds (code types), as
described and used in Path. This is used to allow multiply-
connected paths such as holes within filled polygons.
If not ``None``, ``len(allkinds) == len(allsegs)``. The lists
should look like::

level0kinds = [polygon0kinds, ...]
polygon0kinds = [vertexcode0, vertexcode1, ...]

If *allkinds* is not ``None``, usually all polygons for a
particular contour level are grouped together so that
``level0segs = [polygon0]`` and ``level0kinds = [polygon0kinds]``.

Keyword arguments are as described in the docstring of
`~.Axes.contour`.
"""
self.ax = ax
self.levels = kwargs.pop('levels', None)
self.filled = kwargs.pop('filled', False)
Expand Down Expand Up @@ -1379,7 +1376,7 @@ class QuadContourSet(ContourSet):
"""
Create and store a set of contour lines or filled regions.

User-callable method: :meth:`clabel`
User-callable method: `~.Axes.clabel`

Attributes
----------
Expand Down