|
8 | 8 |
|
9 | 9 |
|
10 | 10 | class AnchoredDrawingArea(AnchoredOffsetbox):
|
11 |
| - """ |
12 |
| - AnchoredOffsetbox with DrawingArea |
13 |
| - """ |
14 |
| - |
| 11 | + @docstring.dedent |
15 | 12 | def __init__(self, width, height, xdescent, ydescent,
|
16 | 13 | loc, pad=0.4, borderpad=0.5, prop=None, frameon=True,
|
17 | 14 | **kwargs):
|
18 | 15 | """
|
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) |
21 | 76 | """
|
22 | 77 | self.da = DrawingArea(width, height, xdescent, ydescent)
|
23 | 78 | self.drawing_area = self.da
|
@@ -80,6 +135,7 @@ def __init__(self, transform, loc,
|
80 | 135 | Attributes
|
81 | 136 | ----------
|
82 | 137 | drawing_area : `matplotlib.offsetbox.AuxTransformBox`
|
| 138 | + A container for artists to display. |
83 | 139 |
|
84 | 140 | Examples
|
85 | 141 | --------
|
|
0 commit comments