Skip to content

Commit d9de808

Browse files
committed
Better document multilinebaseline.
Also set its default to False instead of None. (We only check truthiness, so False and None are equivalent.) Also minor misc. docstring improvements.
1 parent da66560 commit d9de808

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

lib/matplotlib/offsetbox.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -779,23 +779,20 @@ class TextArea(OffsetBox):
779779
@cbook._delete_parameter("3.4", "minimumdescent")
780780
def __init__(self, s,
781781
textprops=None,
782-
multilinebaseline=None,
782+
multilinebaseline=False,
783783
minimumdescent=True,
784784
):
785785
"""
786786
Parameters
787787
----------
788788
s : str
789789
The text to be displayed.
790-
791-
textprops : dict, optional
792-
Dictionary of keyword parameters to be passed to the
793-
`~matplotlib.text.Text` instance contained inside TextArea.
794-
795-
multilinebaseline : bool, optional
796-
If `True`, baseline for multiline text is adjusted so that it is
797-
(approximately) center-aligned with singleline text.
798-
790+
textprops : dict, default: {}
791+
Dictionary of keyword parameters to be passed to the `.Text`
792+
instance in the TextArea.
793+
multilinebaseline : bool, default: False
794+
Whether the baseline for multiline text is adjusted so that it
795+
is (approximately) center-aligned with single-line text.
799796
minimumdescent : bool, default: True
800797
If `True`, the box has a minimum descent of "p". This is now
801798
effectively always True.
@@ -826,8 +823,10 @@ def set_multilinebaseline(self, t):
826823
"""
827824
Set multilinebaseline.
828825
829-
If True, baseline for multiline text is adjusted so that it is
830-
(approximately) center-aligned with single-line text.
826+
If True, the baseline for multiline text is adjusted so that it is
827+
(approximately) center-aligned with single-line text. This is used
828+
e.g. by the legend implementation so that single-line labels are
829+
baseline-aligned, but multiline labels are "center"-aligned with them.
831830
"""
832831
self._multilinebaseline = t
833832
self.stale = True

0 commit comments

Comments
 (0)