Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fb4b612

Browse files
authored
Merge pull request #10904 from timhoffm/doc-axes-contour
Improve docstring of clabel()
2 parents 466d787 + f74582a commit fb4b612

1 file changed

Lines changed: 24 additions & 18 deletions

File tree

lib/matplotlib/contour.py

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,36 +57,37 @@ def clabel(self, *args, **kwargs):
5757
5858
Call signature::
5959
60-
clabel(cs, **kwargs)
60+
clabel(cs, [levels,] **kwargs)
6161
6262
Adds labels to line contours in *cs*, where *cs* is a
6363
:class:`~matplotlib.contour.ContourSet` object returned by
64-
contour.
65-
66-
::
67-
68-
clabel(cs, v, **kwargs)
69-
70-
only labels contours listed in *v*.
64+
``contour()``.
7165
7266
Parameters
7367
----------
68+
cs : `.ContourSet`
69+
The ContourSet to label.
70+
71+
levels : array-like, optional
72+
A list of level values, that should be labeled. The list must be
73+
a subset of ``cs.levels``. If not given, all levels are labeled.
74+
7475
fontsize : string or float, optional
7576
Size in points or relative size e.g., 'smaller', 'x-large'.
76-
See `Text.set_size` for accepted string values.
77+
See `.Text.set_size` for accepted string values.
7778
78-
colors :
79-
Color of each label
79+
colors : color-spec, optional
80+
The label colors:
8081
81-
- if *None*, the color of each label matches the color of
82-
the corresponding contour
82+
- If *None*, the color of each label matches the color of
83+
the corresponding contour.
8384
84-
- if one string color, e.g., *colors* = 'r' or *colors* =
85-
'red', all labels will be plotted in this color
85+
- If one string color, e.g., *colors* = 'r' or *colors* =
86+
'red', all labels will be plotted in this color.
8687
87-
- if a tuple of matplotlib color args (string, float, rgb, etc),
88+
- If a tuple of matplotlib color args (string, float, rgb, etc),
8889
different labels will be plotted in different colors in the order
89-
specified
90+
specified.
9091
9192
inline : bool, optional
9293
If ``True`` the underlying contour is removed where the label is
@@ -128,10 +129,15 @@ def clabel(self, *args, **kwargs):
128129
or minus 90 degrees from level. Default is ``True``.
129130
130131
use_clabeltext : bool, optional
131-
If ``True``, `ClabelText` class (instead of `Text`) is used to
132+
If ``True``, `.ClabelText` class (instead of `.Text`) is used to
132133
create labels. `ClabelText` recalculates rotation angles
133134
of texts during the drawing time, therefore this can be used if
134135
aspect of the axes changes. Default is ``False``.
136+
137+
Returns
138+
-------
139+
labels
140+
A list of `.Text` instances for the labels.
135141
"""
136142

137143
"""

0 commit comments

Comments
 (0)