Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b63a5cb

Browse files
authored
Merge pull request #27510 from meeseeksmachine/auto-backport-of-pr-27346-on-v3.8.x
Backport PR #27346 on branch v3.8.x (DOC: Show and correct default alignment parameters in text.py)
2 parents 93a8cfe + bce5d1a commit b63a5cb

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

galleries/examples/text_labels_and_annotations/text_alignment.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
==============
55
66
Texts are aligned relative to their anchor point depending on the properties
7-
``horizontalalignment`` and ``verticalalignment``.
7+
``horizontalalignment`` (default: ``left``) and ``verticalalignment``
8+
(default: ``baseline``.)
89
910
.. redirect-from:: /gallery/pyplots/text_layout
1011

lib/matplotlib/axes/_axes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,10 @@ def text(self, x, y, s, fontdict=None, **kwargs):
632632
"""
633633
Add text to the Axes.
634634
635-
Add the text *s* to the Axes at location *x*, *y* in data coordinates.
635+
Add the text *s* to the Axes at location *x*, *y* in data coordinates,
636+
with a default ``horizontalalignment`` on the ``left`` and
637+
``verticalalignment`` at the ``baseline``. See
638+
:doc:`/gallery/text_labels_and_annotations/text_alignment`.
636639
637640
Parameters
638641
----------

lib/matplotlib/text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def __init__(self,
123123
124124
The text is aligned relative to the anchor point (*x*, *y*) according
125125
to ``horizontalalignment`` (default: 'left') and ``verticalalignment``
126-
(default: 'bottom'). See also
126+
(default: 'baseline'). See also
127127
:doc:`/gallery/text_labels_and_annotations/text_alignment`.
128128
129129
While Text accepts the 'label' keyword argument, by default it is not
@@ -1251,7 +1251,7 @@ def set_verticalalignment(self, align):
12511251
12521252
Parameters
12531253
----------
1254-
align : {'bottom', 'baseline', 'center', 'center_baseline', 'top'}
1254+
align : {'baseline', 'bottom', 'center', 'center_baseline', 'top'}
12551255
"""
12561256
_api.check_in_list(
12571257
['top', 'bottom', 'center', 'baseline', 'center_baseline'],

0 commit comments

Comments
 (0)