Skip to content

Commit c0a5864

Browse files
committed
Improve docstrings in offsetbox.py
1 parent 779e3ea commit c0a5864

File tree

2 files changed

+28
-39
lines changed

2 files changed

+28
-39
lines changed

doc/api/offsetbox_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
``matplotlib.offsetbox``
33
************************
44

5-
.. inheritance-diagram:: matplotlib.offsetbox.OffsetBox matplotlib.offsetbox.PackerBase matplotlib.offsetbox.VPacker matplotlib.offsetbox.HPacker matplotlib.offsetbox.PaddedBox matplotlib.offsetbox.DrawingArea matplotlib.offsetbox.TextArea matplotlib.offsetbox.AuxTransformBox matplotlib.offsetbox.AnchoredOffsetbox matplotlib.offsetbox.AnchoredText matplotlib.offsetbox.OffsetImage matplotlib.offsetbox.AnnotationBbox matplotlib.offsetbox.DraggableBase matplotlib.offsetbox.DraggableOffsetBox matplotlib.offsetbox.DraggableAnnotation
5+
.. inheritance-diagram:: matplotlib.offsetbox
66
:parts: 1
77

88
.. automodule:: matplotlib.offsetbox

lib/matplotlib/offsetbox.py

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Container classes for `.Artist`\s.
33
44
`OffsetBox`
5-
The base of all container artists.
5+
The base of all container artists defined in this module.
66
77
`AnchoredOffsetbox`, `AnchoredText`
88
Anchor and align an arbitrary `.Artist` or a text relative to the parent
@@ -16,11 +16,10 @@
1616
Containers for layouting their children vertically or horizontally.
1717
1818
`PaddedBox`
19-
A container for add a padding around an `.Artist`.
19+
A container to add a padding around an `.Artist`.
2020
2121
`TextArea`
2222
Contains a single `.Text` instance.
23-
2423
"""
2524

2625
import numpy as np
@@ -396,8 +395,8 @@ def __init__(self, pad=None, sep=None, width=None, height=None,
396395
397396
Notes
398397
-----
399-
*pad* and *sep* need to be given in points and will be scaled with
400-
the renderer dpi, while *width* and *height* need to be in pixels.
398+
*pad* and *sep* are in points and will be scaled with the renderer
399+
dpi, while *width* and *height* are in in pixels.
401400
"""
402401
super().__init__()
403402

@@ -449,8 +448,8 @@ def __init__(self, pad=None, sep=None, width=None, height=None,
449448
450449
Notes
451450
-----
452-
*pad* and *sep* need to be given in points and will be scaled with
453-
the renderer dpi, while *width* and *height* need to be in pixels.
451+
*pad* and *sep* are in points and will be scaled with the renderer
452+
dpi, while *width* and *height* are in in pixels.
454453
"""
455454
super().__init__(pad, sep, width, height, align, mode, children)
456455

@@ -527,8 +526,8 @@ def __init__(self, pad=None, sep=None, width=None, height=None,
527526
528527
Notes
529528
-----
530-
*pad* and *sep* need to be given in points and will be scaled with
531-
the renderer dpi, while *width* and *height* need to be in pixels.
529+
*pad* and *sep* are in points and will be scaled with the renderer
530+
dpi, while *width* and *height* are in in pixels.
532531
"""
533532
super().__init__(pad, sep, width, height, align, mode, children)
534533

@@ -1012,12 +1011,12 @@ def draw(self, renderer):
10121011

10131012
class AnchoredOffsetbox(OffsetBox):
10141013
"""
1015-
A container of an `.OffsetBox` placing it according to location *loc*.
1014+
An offset box placed according to location *loc*.
10161015
1017-
AnchoredOffsetbox has a single child. When multiple children
1018-
is needed, use other OffsetBox class to enclose them. By default,
1019-
the offset box is anchored against its parent axes. You may
1020-
explicitly specify the bbox_to_anchor.
1016+
AnchoredOffsetbox has a single child. When multiple children are needed,
1017+
use an extra OffsetBox to enclose them. By default, the offset box is
1018+
anchored against its parent axes. You may explicitly specify the
1019+
*bbox_to_anchor*.
10211020
"""
10221021
zorder = 5 # zorder of the legend
10231022

@@ -1044,27 +1043,20 @@ def __init__(self, loc,
10441043
Parameters
10451044
----------
10461045
loc : str
1047-
The box location.
1048-
1049-
For back-compatibility, ``'center right'`` (but no other location)
1050-
can also be spelled ``'right'``, and each "string" locations can
1051-
also be given as a numeric value:
1052-
1053-
=============== =============
1054-
Location String Location Code
1055-
=============== =============
1056-
'best' 0
1057-
'upper right' 1
1058-
'upper left' 2
1059-
'lower left' 3
1060-
'lower right' 4
1061-
'right' 5
1062-
'center left' 6
1063-
'center right' 7
1064-
'lower center' 8
1065-
'upper center' 9
1066-
'center' 10
1067-
=============== =============
1046+
The box location. Supported values:
1047+
1048+
- 'upper right'
1049+
- 'upper left'
1050+
- 'lower left'
1051+
- 'lower right'
1052+
- 'center left'
1053+
- 'center right'
1054+
- 'lower center'
1055+
- 'upper center'
1056+
- 'center'
1057+
1058+
For backward compatibility, numeric values are accepted as well.
1059+
See the parameter *loc* of `.Legend` for details.
10681060
10691061
pad : float, default: 0.4
10701062
Padding around the child as fraction of the fontsize.
@@ -1279,9 +1271,6 @@ def _get_anchored_bbox(self, loc, bbox, parentbbox, borderpad):
12791271
class AnchoredText(AnchoredOffsetbox):
12801272
"""
12811273
AnchoredOffsetbox with Text.
1282-
1283-
This is a convenience class. Technically, it is just an `AnchoredOffsetbox`
1284-
containing a `TextArea`.
12851274
"""
12861275

12871276
def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, **kwargs):

0 commit comments

Comments
 (0)