-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: Show and correct default alignment parameters in text.py #27346
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7fd4bb5
Show and correct default alignment parameters in text.py
jsalsman b4461ba
Update text.py: line too long
jsalsman 5c17089
Show defaults in text_alignment.py
jsalsman 1b4f3e1
Make setter method defaults match new docstrings in text.py
jsalsman 1f217b1
IDL text alignment set_ method defaults for text.pyi
jsalsman 9784f01
revert interface defaults in text.pyi
jsalsman c3949bf
revert defaults in alignment set_ methods text.py
jsalsman 5950041
Document text alignment defaults in _axes.py
jsalsman 446a3ba
rm trailing whitespace in _axes.py
jsalsman File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -1002,7 +1002,7 @@ def set_horizontalalignment(self, align): | |
|
||
Parameters | ||
---------- | ||
align : {'left', 'center', 'right'} | ||
align : {'left', 'center', 'right'}, default: left | ||
""" | ||
_api.check_in_list(['center', 'right', 'left'], align=align) | ||
self._horizontalalignment = align | ||
|
@@ -1251,7 +1251,8 @@ def set_verticalalignment(self, align): | |
|
||
Parameters | ||
---------- | ||
align : {'bottom', 'baseline', 'center', 'center_baseline', 'top'} | ||
align : {'bottom', 'baseline', 'center', 'center_baseline', 'top'}, \ | ||
default: baseline | ||
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above: there is no default value here as the |
||
_api.check_in_list( | ||
['top', 'bottom', 'center', 'baseline', 'center_baseline'], | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no default value here as the
align
parameter is not optional (i.e. you can't callset_horizontalalignment()
and expect that it sets the alignement toleft
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if you don't call the setter, the value is
left
. How to convey that in the docs?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default values are (implicitly) documented in the
__init__
method (class signature).Further, matplotlib follows numpydoc conventions:
So the explicit description of the default value is not required in this case, we'd just need to move the
baseline
entry forverticalalignment
to the first position.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.