Skip to content

Commit c22b2eb

Browse files
authored
Merge pull request #20090 from anntzer/aad
Cleanup anchored_artists, inset_locator docstrings.
2 parents 4e10777 + d941ca4 commit c22b2eb

File tree

2 files changed

+76
-189
lines changed

2 files changed

+76
-189
lines changed

lib/mpl_toolkits/axes_grid1/anchored_artists.py

Lines changed: 45 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -24,39 +24,25 @@ def __init__(self, width, height, xdescent, ydescent,
2424
----------
2525
width, height : float
2626
width and height of the container, in pixels.
27-
2827
xdescent, ydescent : float
2928
descent of the container in the x- and y- direction, in pixels.
30-
31-
loc : int
32-
Location of this artist. Valid location codes are::
33-
34-
'upper right' : 1,
35-
'upper left' : 2,
36-
'lower left' : 3,
37-
'lower right' : 4,
38-
'right' : 5,
39-
'center left' : 6,
40-
'center right' : 7,
41-
'lower center' : 8,
42-
'upper center' : 9,
43-
'center' : 10
44-
29+
loc : str
30+
Location of this artist. Valid locations are
31+
'upper left', 'upper center', 'upper right',
32+
'center left', 'center', 'center right',
33+
'lower left', 'lower center, 'lower right'.
34+
For backward compatibility, numeric values are accepted as well.
35+
See the parameter *loc* of `.Legend` for details.
4536
pad : float, default: 0.4
4637
Padding around the child objects, in fraction of the font size.
47-
4838
borderpad : float, default: 0.5
4939
Border padding, in fraction of the font size.
50-
5140
prop : `matplotlib.font_manager.FontProperties`, optional
5241
Font property used as a reference for paddings.
53-
5442
frameon : bool, default: True
5543
If True, draw a box around this artists.
56-
5744
**kwargs
58-
Keyworded arguments to pass to
59-
:class:`matplotlib.offsetbox.AnchoredOffsetbox`.
45+
Keyword arguments forwarded to `.AnchoredOffsetbox`.
6046
6147
Attributes
6248
----------
@@ -98,36 +84,23 @@ def __init__(self, transform, loc,
9884
transform : `matplotlib.transforms.Transform`
9985
The transformation object for the coordinate system in use, i.e.,
10086
:attr:`matplotlib.axes.Axes.transData`.
101-
102-
loc : int
103-
Location of this artist. Valid location codes are::
104-
105-
'upper right' : 1,
106-
'upper left' : 2,
107-
'lower left' : 3,
108-
'lower right' : 4,
109-
'right' : 5,
110-
'center left' : 6,
111-
'center right' : 7,
112-
'lower center' : 8,
113-
'upper center' : 9,
114-
'center' : 10
115-
87+
loc : str
88+
Location of this artist. Valid locations are
89+
'upper left', 'upper center', 'upper right',
90+
'center left', 'center', 'center right',
91+
'lower left', 'lower center, 'lower right'.
92+
For backward compatibility, numeric values are accepted as well.
93+
See the parameter *loc* of `.Legend` for details.
11694
pad : float, default: 0.4
11795
Padding around the child objects, in fraction of the font size.
118-
11996
borderpad : float, default: 0.5
12097
Border padding, in fraction of the font size.
121-
12298
prop : `matplotlib.font_manager.FontProperties`, optional
12399
Font property used as a reference for paddings.
124-
125100
frameon : bool, default: True
126101
If True, draw a box around this artists.
127-
128102
**kwargs
129-
Keyworded arguments to pass to
130-
:class:`matplotlib.offsetbox.AnchoredOffsetbox`.
103+
Keyword arguments forwarded to `.AnchoredOffsetbox`.
131104
132105
Attributes
133106
----------
@@ -162,44 +135,28 @@ def __init__(self, transform, width, height, angle, loc,
162135
transform : `matplotlib.transforms.Transform`
163136
The transformation object for the coordinate system in use, i.e.,
164137
:attr:`matplotlib.axes.Axes.transData`.
165-
166138
width, height : float
167139
Width and height of the ellipse, given in coordinates of
168140
*transform*.
169-
170141
angle : float
171142
Rotation of the ellipse, in degrees, anti-clockwise.
172-
173-
loc : int
174-
Location of this size bar. Valid location codes are::
175-
176-
'upper right' : 1,
177-
'upper left' : 2,
178-
'lower left' : 3,
179-
'lower right' : 4,
180-
'right' : 5,
181-
'center left' : 6,
182-
'center right' : 7,
183-
'lower center' : 8,
184-
'upper center' : 9,
185-
'center' : 10
186-
187-
pad : float, optional
188-
Padding around the ellipse, in fraction of the font size. Defaults
189-
to 0.1.
190-
143+
loc : str
144+
Location of this ellipse. Valid locations are
145+
'upper left', 'upper center', 'upper right',
146+
'center left', 'center', 'center right',
147+
'lower left', 'lower center, 'lower right'.
148+
For backward compatibility, numeric values are accepted as well.
149+
See the parameter *loc* of `.Legend` for details.
150+
pad : float, default: 0.1
151+
Padding around the ellipse, in fraction of the font size.
191152
borderpad : float, default: 0.1
192153
Border padding, in fraction of the font size.
193-
194154
frameon : bool, default: True
195155
If True, draw a box around the ellipse.
196-
197156
prop : `matplotlib.font_manager.FontProperties`, optional
198157
Font property used as a reference for paddings.
199-
200158
**kwargs
201-
Keyworded arguments to pass to
202-
:class:`matplotlib.offsetbox.AnchoredOffsetbox`.
159+
Keyword arguments forwarded to `.AnchoredOffsetbox`.
203160
204161
Attributes
205162
----------
@@ -228,75 +185,54 @@ def __init__(self, transform, size, label, loc,
228185
transform : `matplotlib.transforms.Transform`
229186
The transformation object for the coordinate system in use, i.e.,
230187
:attr:`matplotlib.axes.Axes.transData`.
231-
232188
size : float
233189
Horizontal length of the size bar, given in coordinates of
234190
*transform*.
235-
236191
label : str
237192
Label to display.
238-
239-
loc : int
240-
Location of this size bar. Valid location codes are::
241-
242-
'upper right' : 1,
243-
'upper left' : 2,
244-
'lower left' : 3,
245-
'lower right' : 4,
246-
'right' : 5,
247-
'center left' : 6,
248-
'center right' : 7,
249-
'lower center' : 8,
250-
'upper center' : 9,
251-
'center' : 10
252-
193+
loc : str
194+
Location of this ellipse. Valid locations are
195+
'upper left', 'upper center', 'upper right',
196+
'center left', 'center', 'center right',
197+
'lower left', 'lower center, 'lower right'.
198+
For backward compatibility, numeric values are accepted as well.
199+
See the parameter *loc* of `.Legend` for details.
253200
pad : float, default: 0.1
254201
Padding around the label and size bar, in fraction of the font
255202
size.
256-
257203
borderpad : float, default: 0.1
258204
Border padding, in fraction of the font size.
259-
260205
sep : float, default: 2
261206
Separation between the label and the size bar, in points.
262-
263207
frameon : bool, default: True
264208
If True, draw a box around the horizontal bar and label.
265-
266209
size_vertical : float, default: 0
267210
Vertical length of the size bar, given in coordinates of
268211
*transform*.
269-
270212
color : str, default: 'black'
271213
Color for the size bar and label.
272-
273214
label_top : bool, default: False
274215
If True, the label will be over the size bar.
275-
276216
fontproperties : `matplotlib.font_manager.FontProperties`, optional
277217
Font properties for the label text.
278-
279218
fill_bar : bool, optional
280219
If True and if size_vertical is nonzero, the size bar will
281220
be filled in with the color specified by the size bar.
282221
Defaults to True if *size_vertical* is greater than
283222
zero and False otherwise.
284-
285223
**kwargs
286-
Keyworded arguments to pass to
287-
:class:`matplotlib.offsetbox.AnchoredOffsetbox`.
224+
Keyword arguments forwarded to `.AnchoredOffsetbox`.
288225
289226
Attributes
290227
----------
291228
size_bar : `matplotlib.offsetbox.AuxTransformBox`
292229
Container for the size bar.
293-
294230
txt_label : `matplotlib.offsetbox.TextArea`
295231
Container for the label of the size bar.
296232
297233
Notes
298234
-----
299-
If *prop* is passed as a keyworded argument, but *fontproperties* is
235+
If *prop* is passed as a keyword argument, but *fontproperties* is
300236
not, then *prop* is be assumed to be the intended *fontproperties*.
301237
Using both *prop* and *fontproperties* is not supported.
302238
@@ -354,8 +290,8 @@ def __init__(self, transform, size, label, loc,
354290

355291
class AnchoredDirectionArrows(AnchoredOffsetbox):
356292
def __init__(self, transform, label_x, label_y, length=0.15,
357-
fontsize=0.08, loc=2, angle=0, aspect_ratio=1, pad=0.4,
358-
borderpad=0.4, frameon=False, color='w', alpha=1,
293+
fontsize=0.08, loc='upper left', angle=0, aspect_ratio=1,
294+
pad=0.4, borderpad=0.4, frameon=False, color='w', alpha=1,
359295
sep_x=0.01, sep_y=0, fontproperties=None, back_length=0.15,
360296
head_width=10, head_length=15, tail_width=2,
361297
text_props=None, arrow_props=None,
@@ -368,90 +304,61 @@ def __init__(self, transform, label_x, label_y, length=0.15,
368304
transform : `matplotlib.transforms.Transform`
369305
The transformation object for the coordinate system in use, i.e.,
370306
:attr:`matplotlib.axes.Axes.transAxes`.
371-
372307
label_x, label_y : str
373308
Label text for the x and y arrows
374-
375309
length : float, default: 0.15
376310
Length of the arrow, given in coordinates of *transform*.
377-
378311
fontsize : float, default: 0.08
379312
Size of label strings, given in coordinates of *transform*.
380-
381-
loc : int, default: 2
382-
Location of the direction arrows. Valid location codes are::
383-
384-
'upper right' : 1,
385-
'upper left' : 2,
386-
'lower left' : 3,
387-
'lower right' : 4,
388-
'right' : 5,
389-
'center left' : 6,
390-
'center right' : 7,
391-
'lower center' : 8,
392-
'upper center' : 9,
393-
'center' : 10
394-
313+
loc : str, default: 'upper left'
314+
Location of this ellipse. Valid locations are
315+
'upper left', 'upper center', 'upper right',
316+
'center left', 'center', 'center right',
317+
'lower left', 'lower center, 'lower right'.
318+
For backward compatibility, numeric values are accepted as well.
319+
See the parameter *loc* of `.Legend` for details.
395320
angle : float, default: 0
396321
The angle of the arrows in degrees.
397-
398322
aspect_ratio : float, default: 1
399323
The ratio of the length of arrow_x and arrow_y.
400324
Negative numbers can be used to change the direction.
401-
402325
pad : float, default: 0.4
403326
Padding around the labels and arrows, in fraction of the font size.
404-
405327
borderpad : float, default: 0.4
406328
Border padding, in fraction of the font size.
407-
408329
frameon : bool, default: False
409330
If True, draw a box around the arrows and labels.
410-
411331
color : str, default: 'white'
412332
Color for the arrows and labels.
413-
414333
alpha : float, default: 1
415334
Alpha values of the arrows and labels
416-
417335
sep_x, sep_y : float, default: 0.01 and 0 respectively
418336
Separation between the arrows and labels in coordinates of
419337
*transform*.
420-
421338
fontproperties : `matplotlib.font_manager.FontProperties`, optional
422339
Font properties for the label text.
423-
424340
back_length : float, default: 0.15
425341
Fraction of the arrow behind the arrow crossing.
426-
427342
head_width : float, default: 10
428343
Width of arrow head, sent to ArrowStyle.
429-
430344
head_length : float, default: 15
431345
Length of arrow head, sent to ArrowStyle.
432-
433346
tail_width : float, default: 2
434347
Width of arrow tail, sent to ArrowStyle.
435-
436348
text_props, arrow_props : dict
437349
Properties of the text and arrows, passed to
438350
`.textpath.TextPath` and `.patches.FancyArrowPatch`.
439-
440351
**kwargs
441-
Keyworded arguments to pass to
442-
:class:`matplotlib.offsetbox.AnchoredOffsetbox`.
352+
Keyword arguments forwarded to `.AnchoredOffsetbox`.
443353
444354
Attributes
445355
----------
446356
arrow_x, arrow_y : `matplotlib.patches.FancyArrowPatch`
447357
Arrow x and y
448-
449358
text_path_x, text_path_y : `matplotlib.textpath.TextPath`
450359
Path for arrow labels
451-
452360
p_x, p_y : `matplotlib.patches.PathPatch`
453361
Patch for arrow labels
454-
455362
box : `matplotlib.offsetbox.AuxTransformBox`
456363
Container for the arrows and labels.
457364

0 commit comments

Comments
 (0)