Skip to content

Commit

Permalink
Backport PR matplotlib#27346: DOC: Show and correct default alignment…
Browse files Browse the repository at this point in the history
… parameters in text.py
  • Loading branch information
jsalsman authored and meeseeksmachine committed Dec 13, 2023
1 parent 93a8cfe commit bce5d1a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
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'}
"""
_api.check_in_list(
['top', 'bottom', 'center', 'baseline', 'center_baseline'],
Expand Down

0 comments on commit bce5d1a

Please sign in to comment.