8000 Add documentation for axes_grid1's AnchoredDrawingArea · matplotlib/matplotlib@63c4e92 · GitHub
[go: up one dir, main page]

Skip to content

Commit 63c4e92

Browse files
committed
Add documentation for axes_grid1's AnchoredDrawingArea
1 parent 36aafbf commit 63c4e92

File tree

1 file changed

+62
-6
lines changed

1 file changed

+62
-6
lines changed

lib/mpl_toolkits/axes_grid1/anchored_artists.py

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,71 @@
88

99

1010
class AnchoredDrawingArea(AnchoredOffsetbox):
11-
"""
12-
AnchoredOffsetbox with DrawingArea
13-
"""
14-
11+
@docstring.dedent
1512
def __init__(self, width, height, xdescent, ydescent,
1613
loc, pad=0.4, borderpad=0.5, prop=None, frameon=True,
1714
**kwargs):
1815
"""
19-
*width*, *height*, *xdescent*, *ydescent* : the dimensions of the DrawingArea.
20-
*prop* : font property. This is only used for scaling the paddings.
16+
An anchored container with a fixed size and fillable DrawingArea.
17+
18+
Artists added to the *drawing_area* will have their coordinates
19+
interpreted as pixels. Any transformations set on the artists will be
20+
overridden.
21+
22+
Parameters
23+
----------
24+
width, height : int or float
25+
width and height of the container, in pixels.
26+
27+
xdescent, ydescent : int or float
28+
descent of the container in the x- and y- direction, in pixels.
29+
30+
loc : int
31+
Location of this artist. Valid location codes are::
32+
33+
'upper right' : 1,
34+
'upper left' : 2,
35+
'lower left' : 3,
36+
'lower right' : 4,
37+
'right' : 5,
38+
'center left' : 6,
39+
'center right' : 7,
40+
'lower center' : 8,
41+
'upper center' : 9,
42+
'center' : 10
43+
44+
pad : int or float, optional
45+
Padding around the child objects, in fraction of the font
46+
size. Defaults to 0.4.
47+
48+
borderpad : int or float, optional
49+
Border padding, in fraction of the font size.
50+
Defaults to 0.5.
51+
52+
prop : `matplotlib.font_manager.FontProperties`, optional
53+
Font property used as a reference for paddings.
54+
55+
frameon : bool, optional
56+
If True, draw a box around this artists. Defaults to True.
57+
58+
**kwargs :
59+
Keyworded arguments to pass to
60+
:class:`matplotlib.offsetbox.AnchoredOffsetbox`.
61+
62+
Attributes
63+
----------
64+
drawing_area : `matplotlib.offsetbox.DrawingArea`
65+
A container for artists to display.
66+
67+
Examples
68+
--------
69+
To display blue and red circles of different sizes in the upper right
70+
of an axes *ax*:
71+
72+
>>> ada = AnchoredDrawingArea(20, 20, 0, 0, loc=1, frameon=False)
73+
>>> ada.drawing_area.add_artist(Circle((10, 10), 10, fc="b"))
74+
>>> ada.drawing_area.add_artist(Circle((30, 10), 5, fc="r"))
75+
>>> ax.add_artist(ada)
2176
"""
2277
self.da = DrawingArea(width, height, xdescent, ydescent)
2378
self.drawing_area = self.da
@@ -80,6 +135,7 @@ def __init__(self, transform, loc,
80135
Attributes
81136
----------
82137
drawing_area : `matplotlib.offsetbox.AuxTransformBox`
138+
A container for artists to display.
83139
84140
Examples
85141
--------

0 commit comments

Comments
 (0)
0