Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Use (float, float) as parameter type for 2D positions in docstrings#12237

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
NelleV merged 1 commit intomatplotlib:masterfromtimhoffm:doc-xy
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionlib/matplotlib/backend_bases.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1848,7 +1848,7 @@ def enter_notify_event(self, guiEvent=None, xy=None):
----------
guiEvent
the native UI event that generated the mpl event
xy :tuple of 2 scalars
xy :(float, float)
the coordinate location of the pointer when the canvas is
entered

Expand Down
41 changes: 30 additions & 11 deletionslib/matplotlib/offsetbox.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -179,9 +179,16 @@ def contains(self, mouseevent):

def set_offset(self, xy):
"""
Set the offset
Set the offset.

accepts x, y, tuple, or a callable object.
Parameters
----------
xy : (float, float) or callable
The (x,y) coordinates of the offset in display units.
A callable must have the signature::

def offset(width, height, xdescent, ydescent, renderer) \
Copy link
Member

Choose a reason for hiding this comment

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

I don't get line 191 here... Do you mean it should return (float, float)?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This is the notation for the return type hint.
https://13820-1385122-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/api/offsetbox_api.html#matplotlib.offsetbox.OffsetBox.set_offset

We're already using this in other places such as:
https://13820-1385122-gh.circle-artifacts.com/0/home/circleci/project/doc/build/html/api/_as_gen/matplotlib.artist.Artist.set_contains.html#matplotlib.artist.Artist.set_contains

I've just not annotated the function parameters in this example to keep it more readable, and their types are quite obvious anyway.

-> (float, float)
"""
self._offset = xy
self.stale = True
Expand DownExpand Up@@ -602,9 +609,12 @@ def set_transform(self, t):

def set_offset(self, xy):
"""
set offset of the container.
Set the offset of the container.

Accept : tuple of x,y coordinate in display units.
Parameters
----------
xy : (float, float)
The (x,y) coordinates of the offset in display units.
"""
self._offset = xy

Expand DownExpand Up@@ -773,9 +783,12 @@ def set_transform(self, t):

def set_offset(self, xy):
"""
set offset of the container.
Set the offset of the container.
Copy link
Member

Choose a reason for hiding this comment

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

the extra "the" wasn't really necessary here.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I think we mostly use the form with the article in the docs. But I don't care too much.


Accept : tuple of x,y coordinates in display units.
Parameters
----------
xy : (float, float)
The (x,y) coordinates of the offset in display units.
"""
self._offset = xy

Expand DownExpand Up@@ -891,9 +904,12 @@ def set_transform(self, t):

def set_offset(self, xy):
"""
set offset of the container.
Set the offset of the container.

Accept : tuple of x,y coordinate in display units.
Parameters
----------
xy : (float, float)
The (x,y) coordinates of the offset in display units.
"""
self._offset = xy

Expand DownExpand Up@@ -1294,9 +1310,12 @@ def get_zoom(self):

# def set_offset(self, xy):
# """
# set offset of the container.

# Accept : tuple of x,y coordinate in display units.
# Set the offset of the container.
#
# Parameters
# ----------
# xy : (float, float)
# The (x,y) coordinates of the offset in display units.
# """
# self._offset = xy

Expand Down
18 changes: 9 additions & 9 deletionslib/matplotlib/patches.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -660,15 +660,15 @@ def __init__(self, xy, width, height, angle=0.0, **kwargs):
"""
Parameters
----------
xy: length-2 tuple
xy : (float, float)
The bottom and left rectangle coordinates
width:
width : float
Rectangle width
height:
height : float
Rectangle height
angle: float, optional
angle: float, optional
rotation in degrees anti-clockwise about *xy* (default is 0.0)
fill: bool, optional
fill: bool, optional
Whether to fill the rectangle (default is ``True``)

Notes
Expand DownExpand Up@@ -769,7 +769,7 @@ def set_xy(self, xy):

Parameters
----------
xy :2-item sequence
xy :(float, float)
"""
self._x0, self._y0 = xy
self._update_x1()
Expand DownExpand Up@@ -1444,11 +1444,11 @@ def __init__(self, xy, width, height, angle=0, **kwargs):
"""
Parameters
----------
xy :tuple of (scalar, scalar)
xy :(float, float)
xy coordinates of ellipse centre.
width :scalar
width :float
Total length (diameter) of horizontal axis.
height :scalar
height :float
Total length (diameter) of vertical axis.
angle : scalar, optional
Rotation in degrees anti-clockwise.
Expand Down
2 changes: 1 addition & 1 deletionlib/matplotlib/projections/polar.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -760,7 +760,7 @@ class _WedgeBbox(mtransforms.Bbox):

Parameters
----------
center :tuple offloat
center :(float,float)
Center of the wedge
viewLim : `~matplotlib.transforms.Bbox`
Bbox determining the boundaries of the wedge
Expand Down
2 changes: 1 addition & 1 deletionlib/matplotlib/widgets.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2762,7 +2762,7 @@ class Lasso(AxesWidget):
----------
ax : `~matplotlib.axes.Axes`
The parent axes for the widget.
xy :array
xy :(float, float)
Coordinates of the start of the lasso.
callback : callable
Whenever the lasso is released, the `callback` function is called and
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp