Skip to content

Commit e66b5d8

Browse files
authored
Merge pull request #9186 from dstansby/clabel-docstring
Convert clabel docstring to numpydoc
2 parents aee7196 + b1dbf5d commit e66b5d8

File tree

1 file changed

+36
-30
lines changed

1 file changed

+36
-30
lines changed

lib/matplotlib/contour.py

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,15 @@ def clabel(self, *args, **kwargs):
7575
7676
only labels contours listed in *v*.
7777
78-
Optional keyword arguments:
78+
Parameters
79+
----------
80+
fontsize : string or float, optional
81+
Size in points or relative size e.g., 'smaller', 'x-large'.
82+
See `Text.set_size` for accepted string values.
7983
80-
*fontsize*:
81-
size in points or relative size e.g., 'smaller', 'x-large'
84+
colors :
85+
Color of each label
8286
83-
*colors*:
8487
- if *None*, the color of each label matches the color of
8588
the corresponding contour
8689
@@ -91,47 +94,50 @@ def clabel(self, *args, **kwargs):
9194
different labels will be plotted in different colors in the order
9295
specified
9396
94-
*inline*:
95-
controls whether the underlying contour is removed or
96-
not. Default is *True*.
97+
inline : bool, optional
98+
If ``True`` the underlying contour is removed where the label is
99+
placed. Default is ``True``.
100+
101+
inline_spacing : float, optional
102+
Space in pixels to leave on each side of label when
103+
placing inline. Defaults to 5.
104+
105+
This spacing will be exact for labels at locations where the
106+
contour is straight, less so for labels on curved contours.
97107
98-
*inline_spacing*:
99-
space in pixels to leave on each side of label when
100-
placing inline. Defaults to 5. This spacing will be
101-
exact for labels at locations where the contour is
102-
straight, less so for labels on curved contours.
108+
fmt : string or dict, optional
109+
A format string for the label. Default is '%1.3f'
103110
104-
*fmt*:
105-
a format string for the label. Default is '%1.3f'
106111
Alternatively, this can be a dictionary matching contour
107112
levels with arbitrary strings to use for each contour level
108113
(i.e., fmt[level]=string), or it can be any callable, such
109114
as a :class:`~matplotlib.ticker.Formatter` instance, that
110115
returns a string when called with a numeric contour level.
111116
112-
*manual*:
113-
if *True*, contour labels will be placed manually using
114-
mouse clicks. Click the first button near a contour to
117+
manual : bool or iterable, optional
118+
If ``True``, contour labels will be placed manually using
119+
mouse clicks. Click the first button near a contour to
115120
add a label, click the second button (or potentially both
116-
mouse buttons at once) to finish adding labels. The third
121+
mouse buttons at once) to finish adding labels. The third
117122
button can be used to remove the last label added, but
118-
only if labels are not inline. Alternatively, the keyboard
123+
only if labels are not inline. Alternatively, the keyboard
119124
can be used to select label locations (enter to end label
120125
placement, delete or backspace act like the third mouse button,
121126
and any other key will select a label location).
122127
123-
*manual* can be an iterable object of x,y tuples. Contour labels
124-
will be created as if mouse is clicked at each x,y positions.
128+
*manual* can also be an iterable object of x,y tuples.
129+
Contour labels will be created as if mouse is clicked at each
130+
x,y positions.
125131
126-
*rightside_up*:
127-
if *True* (default), label rotations will always be plus
128-
or minus 90 degrees from level.
132+
rightside_up : bool, optional
133+
If ``True``, label rotations will always be plus
134+
or minus 90 degrees from level. Default is ``True``.
129135
130-
*use_clabeltext*:
131-
if *True* (default is False), ClabelText class (instead of
132-
matplotlib.Text) is used to create labels. ClabelText
133-
recalculates rotation angles of texts during the drawing time,
134-
therefore this can be used if aspect of the axes changes.
136+
use_clabeltext : bool, optional
137+
If ``True``, `ClabelText` class (instead of `Text`) is used to
138+
create labels. `ClabelText` recalculates rotation angles
139+
of texts during the drawing time, therefore this can be used if
140+
aspect of the axes changes. Default is ``False``.
135141
"""
136142

137143
"""
@@ -144,7 +150,7 @@ def clabel(self, *args, **kwargs):
144150
145151
Once these attributes are set, clabel passes control to the
146152
labels method (case of automatic label placement) or
147-
BlockingContourLabeler (case of manual label placement).
153+
`BlockingContourLabeler` (case of manual label placement).
148154
"""
149155

150156
fontsize = kwargs.get('fontsize', None)

0 commit comments

Comments
 (0)