Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 14745cd

Browse filesBrowse files
committed
Harmonize descriptions of the 'anchor' parameter.
... across the library. I left the table for Axes.set_anchor (likely the most common entry-point), but it doesn't seem worth copying it at the other use sites. Divider.set_anchor also supports pairs of floats (it just forwards to Bbox.anchored anyways).
1 parent a08e334 commit 14745cd
Copy full SHA for 14745cd

File tree

Expand file treeCollapse file tree

3 files changed

+32
-53
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+32
-53
lines changed

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+15-22Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,28 +1780,21 @@ def set_anchor(self, anchor, share=False):
17801780
17811781
Parameters
17821782
----------
1783-
anchor : 2-tuple of floats or {'C', 'SW', 'S', 'SE', ...}
1784-
The anchor position may be either:
1785-
1786-
- a sequence (*cx*, *cy*). *cx* and *cy* may range from 0
1787-
to 1, where 0 is left or bottom and 1 is right or top.
1788-
1789-
- a string using cardinal directions as abbreviation:
1790-
1791-
- 'C' for centered
1792-
- 'S' (south) for bottom-center
1793-
- 'SW' (south west) for bottom-left
1794-
- etc.
1795-
1796-
Here is an overview of the possible positions:
1797-
1798-
+------+------+------+
1799-
| 'NW' | 'N' | 'NE' |
1800-
+------+------+------+
1801-
| 'W' | 'C' | 'E' |
1802-
+------+------+------+
1803-
| 'SW' | 'S' | 'SE' |
1804-
+------+------+------+
1783+
anchor : (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}
1784+
Either an (*x*, *y*) pair of relative coordinates (0 is left or
1785+
bottom, 1 is right or top), 'C' (center), or a cardinal direction
1786+
('SW', southwest, is bottom left, etc.). str inputs are shorthands
1787+
for (*x*, *y*) coordinates, as shown in the following table::
1788+
1789+
.. code-block:: none
1790+
1791+
+-----------------+-----------------+-----------------+
1792+
| 'NW' (0.0, 1.0) | 'N' (0.5, 1.0) | 'NE' (1.0, 1.0) |
1793+
+-----------------+-----------------+-----------------+
1794+
| 'W' (0.0, 0.5) | 'C' (0.5, 0.5) | 'E' (1.0, 0.5) |
1795+
+-----------------+-----------------+-----------------+
1796+
| 'SW' (0.0, 0.0) | 'S' (0.5, 0.0) | 'SE' (1.0, 0.0) |
1797+
+-----------------+-----------------+-----------------+
18051798
18061799
share : bool, default: False
18071800
If ``True``, apply the settings to all shared Axes.

‎lib/matplotlib/transforms.py

Copy file name to clipboardExpand all lines: lib/matplotlib/transforms.py
+9-14Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -513,26 +513,21 @@ def inverse_transformed(self, transform):
513513

514514
def anchored(self, c, container=None):
515515
"""
516-
Return a copy of the `Bbox` shifted to position *c* within *container*.
516+
Return a copy of the `Bbox` anchored to *c* within *container*.
517517
518518
Parameters
519519
----------
520-
c : (float, float) or str
521-
May be either:
522-
523-
* A sequence (*cx*, *cy*) where *cx* and *cy* range from 0
524-
to 1, where 0 is left or bottom and 1 is right or top
525-
526-
* a string:
527-
- 'C' for centered
528-
- 'S' for bottom-center
529-
- 'SE' for bottom-left
530-
- 'E' for left
531-
- etc.
532-
520+
c : (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}
521+
Either an (*x*, *y*) pair of relative coordinates (0 is left or
522+
bottom, 1 is right or top), 'C' (center), or a cardinal direction
523+
('SW', southwest, is bottom left, etc.).
533524
container : `Bbox`, optional
534525
The box within which the `Bbox` is positioned; it defaults
535526
to the initial `Bbox`.
527+
528+
See Also
529+
--------
530+
.Axes.set_anchor
536531
"""
537532
if container is None:
538533
container = self

‎lib/mpl_toolkits/axes_grid1/axes_divider.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axes_grid1/axes_divider.py
+8-17Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,14 @@ def set_anchor(self, anchor):
104104
"""
105105
Parameters
106106
----------
107-
anchor : {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'}
108-
anchor position
109-
110-
===== ============
111-
value description
112-
===== ============
113-
'C' Center
114-
'SW' bottom left
115-
'S' bottom
116-
'SE' bottom right
117-
'E' right
118-
'NE' top right
119-
'N' top
120-
'NW' top left
121-
'W' left
122-
===== ============
123-
107+
anchor : (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}
108+
Either an (*x*, *y*) pair of relative coordinates (0 is left or
109+
bottom, 1 is right or top), 'C' (center), or a cardinal direction
110+
('SW', southwest, is bottom left, etc.).
111+
112+
See Also
113+
--------
114+
.Axes.set_anchor
124115
"""
125116
if len(anchor) != 2:
126117
_api.check_in_list(mtransforms.Bbox.coefs, anchor=anchor)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.