Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
==============

Texts are aligned relative to their anchor point depending on the properties
``horizontalalignment`` and ``verticalalignment``.
``horizontalalignment`` (default: ``left``) and ``verticalalignment``
(default: ``baseline``.)

.. redirect-from:: /gallery/pyplots/text_layout

Expand Down
5 changes: 4 additions & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,10 @@ def text(self, x, y, s, fontdict=None, **kwargs):
"""
Add text to the Axes.

Add the text *s* to the Axes at location *x*, *y* in data coordinates.
Add the text *s* to the Axes at location *x*, *y* in data coordinates,
with a default ``horizontalalignment`` on the ``left`` and
``verticalalignment`` at the ``baseline``. See
:doc:`/gallery/text_labels_and_annotations/text_alignment`.

Parameters
----------
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def __init__(self,

The text is aligned relative to the anchor point (*x*, *y*) according
to ``horizontalalignment`` (default: 'left') and ``verticalalignment``
(default: 'bottom'). See also
(default: 'baseline'). See also
:doc:`/gallery/text_labels_and_annotations/text_alignment`.

While Text accepts the 'label' keyword argument, by default it is not
Expand Down Expand Up @@ -1251,7 +1251,7 @@ def set_verticalalignment(self, align):

Parameters
----------
align : {'bottom', 'baseline', 'center', 'center_baseline', 'top'}
align : {'baseline', 'bottom', 'center', 'center_baseline', 'top'}
"""
Copy link
Contributor

@StefRe StefRe Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above: there is no default value here as the align parameter is not optional.

_api.check_in_list(
['top', 'bottom', 'center', 'baseline', 'center_baseline'],
Expand Down