@@ -94,7 +94,7 @@ def _update_bbox_to_anchor(self, loc_in_canvas):
94
94
self .legend .set_bbox_to_anchor (loc_in_bbox )
95
95
96
96
97
- _legend_kw_doc = '''
97
+ docstring . interpd . update ( _legend_kw_doc = """
98
98
loc : str or pair of floats, default: :rc:`legend.loc` ('best' for axes, \
99
99
'upper right' for figures)
100
100
The location of the legend.
@@ -175,58 +175,49 @@ def _update_bbox_to_anchor(self, loc_in_canvas):
175
175
absolute font size in points. String values are relative to the current
176
176
default font size. This argument is only used if *prop* is not specified.
177
177
178
- numpoints : None or int
178
+ numpoints : int, default: :rc:`legend.numpoints`
179
179
The number of marker points in the legend when creating a legend
180
180
entry for a `.Line2D` (line).
181
- Default is ``None``, which means using :rc:`legend.numpoints`.
182
181
183
- scatterpoints : None or int
182
+ scatterpoints : int, default: :rc:`legend.scatterpoints`
184
183
The number of marker points in the legend when creating
185
184
a legend entry for a `.PathCollection` (scatter plot).
186
- Default is ``None``, which means using :rc:`legend.scatterpoints`.
187
185
188
186
scatteryoffsets : iterable of floats, default: ``[0.375, 0.5, 0.3125]``
189
187
The vertical offset (relative to the font size) for the markers
190
188
created for a scatter plot legend entry. 0.0 is at the base the
191
189
legend text, and 1.0 is at the top. To draw all markers at the
192
190
same height, set to ``[0.5]``.
193
191
194
- markerscale : None or float
192
+ markerscale : float, default: :rc:`legend.markerscale`
195
193
The relative size of legend markers compared with the originally
196
194
drawn ones.
197
- Default is ``None``, which means using :rc:`legend.markerscale`.
198
195
199
196
markerfirst : bool, default: True
200
197
If *True*, legend marker is placed to the left of the legend label.
201
198
If *False*, legend marker is placed to the right of the legend label.
202
199
203
- frameon : None or bool
200
+ frameon : bool, default: :rc:`legend.frameon`
204
201
Whether the legend should be drawn on a patch (frame).
205
- Default is ``None``, which means using :rc:`legend.frameon`.
206
202
207
- fancybox : None or bool
203
+ fancybox : bool, default: :rc:`legend.fancybox`
208
204
Whether round edges should be enabled around the `~.FancyBboxPatch` which
209
205
makes up the legend's background.
210
- Default is ``None``, which means using :rc:`legend.fancybox`.
211
206
212
- shadow : None or bool
207
+ shadow : bool, default: :rc:`legend.shadow`
213
208
Whether to draw a shadow behind the legend.
214
- Default is ``None``, which means using :rc:`legend.shadow`.
215
209
216
- framealpha : None or float
210
+ framealpha : float, default: :rc:`legend.framealpha`
217
211
The alpha transparency of the legend's background.
218
- Default is ``None``, which means using :rc:`legend.framealpha`.
219
212
If *shadow* is activated and *framealpha* is ``None``, the default value is
220
213
ignored.
221
214
222
- facecolor : None or "inherit" or color
215
+ facecolor : "inherit" or color, default: :rc:`legend.facecolor`
223
216
The legend's background color.
224
- Default is ``None``, which means using :rc:`legend.facecolor`.
225
217
If ``"inherit"``, use :rc:`axes.facecolor`.
226
218
227
- edgecolor : None or "inherit" or color
219
+ edgecolor : "inherit" or color, default: :rc:`legend.edgecolor`
228
220
The legend's background patch edge color.
229
- Default is ``None``, which means using :rc:`legend.edgecolor`.
230
221
If ``"inherit"``, use take :rc:`axes.edgecolor`.
231
222
232
223
mode : {"expand", None}
@@ -245,37 +236,29 @@ def _update_bbox_to_anchor(self, loc_in_canvas):
245
236
title_fontsize: str or None
246
237
The fontsize of the legend's title. Default is the default fontsize.
247
238
248
- borderpad : float or None
239
+ borderpad : float, default: :rc:`legend.borderpad`
249
240
The fractional whitespace inside the legend border, in font-size units.
250
- Default is ``None``, which means using :rc:`legend.borderpad`.
251
241
252
- labelspacing : float or None
242
+ labelspacing : float, default: :rc:`legend.labelspacing`
253
243
The vertical space between the legend entries, in font-size units.
254
- Default is ``None``, which means using :rc:`legend.labelspacing`.
255
244
256
- handlelength : float or None
245
+ handlelength : float, default: :rc:`legend.handlelength`
257
246
The length of the legend handles, in font-size units.
258
- Default is ``None``, which means using :rc:`legend.handlelength`.
259
247
260
- handletextpad : float or None
248
+ handletextpad : float, default: :rc:`legend.handletextpad`
261
249
The pad between the legend handle and text, in font-size units.
262
- Default is ``None``, which means using :rc:`legend.handletextpad`.
263
250
264
- borderaxespad : float or None
251
+ borderaxespad : float, default: :rc:`legend.borderaxespad`
265
252
The pad between the axes and legend border, in font-size units.
266
- Default is ``None``, which means using :rc:`legend.borderaxespad`.
267
253
268
- columnspacing : float or None
254
+ columnspacing : float, default: :rc:`legend.columnspacing`
269
255
The spacing between columns, in font-size units.
270
- Default is ``None``, which means using :rc:`legend.columnspacing`.
271
256
272
257
handler_map : dict or None
273
258
The custom dictionary mapping instances or types to a legend
274
259
handler. This `handler_map` updates the default handler map
275
260
found at :func:`matplotlib.legend.Legend.get_legend_handler_map`.
276
-
277
- '''
278
- docstring .interpd .update (_legend_kw_doc = _legend_kw_doc )
261
+ """ )
279
262
280
263
281
264
class Legend (Artist ):
@@ -905,7 +888,7 @@ def draw_frame(self, b):
905
888
self .set_frame_on (b )
906
889
907
890
def get_children (self ):
908
- ' Return a list of child artists.'
891
+ """ Return the list of child artists."""
909
892
children = []
910
893
if self ._legend_box :
911
894
children .append (self ._legend_box )
@@ -914,23 +897,21 @@ def get_children(self):
914
897
return children
915
898
916
899
def get_frame (self ):
917
- '''
918
- Return the `~.patches.Rectangle` instances used to frame the legend.
919
- '''
900
+ """Return the `~.patches.Rectangle` used to frame the legend."""
920
901
return self .legendPatch
921
902
922
903
def get_lines (self ):
923
- ' Return a list of `~.lines.Line2D` instances in the legend.'
904
+ r""" Return the list of `~.lines.Line2D`\s in the legend."""
924
905
return [h for h in self .legendHandles if isinstance (h , Line2D )]
925
906
926
907
def get_patches (self ):
927
- ' Return a list of `~.patches.Patch` instances in the legend.'
908
+ r""" Return the list of `~.patches.Patch`\s in the legend."""
928
909
return silent_list ('Patch' ,
929
910
[h for h in self .legendHandles
930
911
if isinstance (h , Patch )])
931
912
932
913
def get_texts (self ):
933
- ' Return a list of `~.text.Text` instances in the legend.'
914
+ r""" Return the list of `~.text.Text`\s in the legend."""
934
915
return silent_list ('Text' , self .texts )
935
916
936
917
def set_title (self , title , prop = None ):
@@ -954,11 +935,11 @@ def set_title(self, title, prop=None):
954
935
self .stale = True
955
936
956
937
def get_title (self ):
957
- ' Return the `.Text` instance for the legend title.'
938
+ """ Return the `.Text` instance for the legend title."""
958
939
return self ._legend_title_box ._text
959
940
960
941
def get_window_extent (self , renderer = None ):
961
- 'Return extent of the legend.'
942
+ # docstring inherited
962
943
if renderer is None :
963
944
renderer = self .figure ._cachedRenderer
964
945
return self ._legend_box .get_window_extent (renderer = renderer )
0 commit comments