8000 Merge pull request #12237 from timhoffm/doc-xy · matplotlib/matplotlib@2603ebc · GitHub
[go: up one dir, main page]

Skip to content

Commit 2603ebc

Browse files
authored
Merge pull request #12237 from timhoffm/doc-xy
Use (float, float) as parameter type for 2D positions in docstrings
2 parents 70a55db + 31ec0ed commit 2603ebc

File tree

5 files changed

+42
-23
lines changed

5 files changed

+42
-23
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ def enter_notify_event(self, guiEvent=None, xy=None):
18481848
----------
18491849
guiEvent
18501850
the native UI event that generated the mpl event
1851-
xy : tuple of 2 scalars
1851+
xy : (float, float)
18521852
the coordinate location of the pointer when the canvas is
18531853
entered
18541854

lib/matplotlib/offsetbox.py

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,16 @@ def contains(self, mouseevent):
179179

180180
def set_offset(self, xy):
181181
"""
182-
Set the offset
182+
Set the offset.
183183
184-
accepts x, y, tuple, or a callable object.
184+
Parameters
185+
----------
186+
xy : (float, float) or callable
187+
The (x,y) coordinates of the offset in display units.
188+
A callable must have the signature::
189+
190+
def offset(width, height, xdescent, ydescent, renderer) \
191+
-> (float, float)
185192
"""
186193
self._offset = xy
187194
self.stale = True
@@ -602,9 +609,12 @@ def set_transform(self, t):
602609

603610
def set_offset(self, xy):
604611
"""
605-
set offset of the container.
612+
Set the offset of the container.
606613
607-
Accept : tuple of x,y coordinate in display units.
614+
Parameters
615+
----------
616+
xy : (float, float)
617+
The (x,y) coordinates of the offset in display units.
608618
"""
609619
self._offset = xy
610620

@@ -773,9 +783,12 @@ def set_transform(self, t):
773783

774784
def set_offset(self, xy):
775785
"""
776-
set offset of the container.
786+
Set the offset of the container.
777787
778-
Accept : tuple of x,y coordinates in display units.
788+
Parameters
789+
----------
790+
xy : (float, float)
791+
The (x,y) coordinates of the offset in display units.
779792
"""
780793
self._offset = xy
781794

@@ -891,9 +904,12 @@ def set_transform(self, t):
891904

892905
def set_offset(self, xy):
893906
"""
894-
set offset of the container.
907+
Set the offset of the container.
895908
896-
Accept : tuple of x,y coordinate in display units.
909+
Parameters
910+
----------
911+
xy : (float, float)
912+
The (x,y) coordinates of the offset in display units.
897913
"""
898914
self._offset = xy
899915

@@ -1294,9 +1310,12 @@ def get_zoom(self):
12941310

12951311
# def set_offset(self, xy):
12961312
# """
1297-
# set offset of the container.
1298-
1299-
# Accept : tuple of x,y coordinate in display units.
1313+
# Set the offset of the container.
1314+
#
1315+
# Parameters
1316+
# ----------
1317+
# xy : (float, float)
1318+
# The (x,y) coordinates of the offset in display units.
13001319
# """
13011320
# self._offset = xy
13021321

lib/matplotlib/patches.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -660,15 +660,15 @@ def __init__(self, xy, width, height, angle=0.0, **kwargs):
660660
"""
661661
Parameters
662662
----------
663-
xy: length-2 tuple
663+
xy : (float, float)
664664
The bottom and left rectangle coordinates
665-
width:
665+
width : float
666666
Rectangle width
667-
height:
667+
height : float
668668
Rectangle height
669-
angle: float, optional
669+
angle : float, optional
670670
rotation in degrees anti-clockwise about *xy* (default is 0.0)
671-
fill: bool, optional
671+
fill : bool, optional
672672
Whether to fill the rectangle (default is ``True``)
673673
674674
Notes
@@ -769,7 +769,7 @@ def set_xy(self, xy):
769769
770770
Parameters
771771
----------
772-
xy : 2-item sequence
772+
xy : (float, float)
773773
"""
774774
self._x0, self._y0 = xy
775775
self._update_x1()
@@ -1444,11 +1444,11 @@ def __init__(self, xy, width, height, angle=0, **kwargs):
14441444
"""
14451445
Parameters
14461446
----------
1447-
xy : tuple of (scalar, scalar)
1447+
xy : (float, float)
14481448
xy coordinates of ellipse centre.
1449-
width : scalar
1449+
width : float
14501450
Total length (diameter) of horizontal axis.
1451-
height : scalar
1451+
height : float
14521452
Total length (diameter) of vertical axis.
14531453
angle : scalar, optional
14541454
Rotation in degrees anti-clockwise.

lib/matplotlib/projections/polar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ class _WedgeBbox(mtransforms.Bbox):
760760
761761
Parameters
762762
----------
763-
center : tuple of float
763+
center : (float, float)
764764
Center of the wedge
765765
viewLim : `~matplotlib.transforms.Bbox`
766766
Bbox determining the boundaries of the wedge

lib/matplotlib/widgets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2762,7 +2762,7 @@ class Lasso(AxesWidget):
27622762
----------
27632763
ax : `~matplotlib.axes.Axes`
27642764
The parent axes for the widget.
2765-
xy : array
2765+
xy : (float, float)
27662766
Coordinates of the start of the lasso.
27672767
callback : callable
27682768
Whenever the lasso is released, the `callback` function is called and

0 commit comments

Comments
 (0)
0