Skip to content

Backport PR #11090 on branch v2.2.2-doc #11102

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

Closed
wants to merge 1 commit into from
Closed
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 @@ -735,7 +735,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 @@ -754,44 +789,6 @@ class ContourSet(cm.ScalarMappable, ContourLabeler):
"""

def __init__(self, ax, *args, **kwargs):
"""
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 @@ -1377,7 +1374,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