10000 numpydocify quiverkey. · matplotlib/matplotlib@3c860bc · GitHub
[go: up one dir, main page]

Skip to content

Commit 3c860bc

Browse files
committed
numpydocify quiverkey.
1 parent dd18211 commit 3c860bc

File tree

3 files changed

+55
-69
lines changed

3 files changed

+55
-69
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Deprecations
2+
````````````
3+
4+
``quiver.QuiverKey.quiverkey_doc`` is deprecated; use
5+
``quiver.QuiverKey.__init__.__doc__`` instead.

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4991,11 +4991,11 @@ def arrow(self, x, y, dx, dy, **kwargs):
49914991
self.add_artist(a)
49924992
return a
49934993

4994+
@docstring.copy(mquiver.QuiverKey.__init__)
49944995
def quiverkey(self, Q, X, Y, U, label, **kw):
49954996
qk = mquiver.QuiverKey(Q, X, Y, U, label, **kw)
49964997
self.add_artist(qk)
49974998
return qk
4998-
quiverkey.__doc__ = mquiver.QuiverKey.quiverkey_doc
49994999

50005000
# Handle units for x and y, if they've been passed
50015001
def _quiver_units(self, args, kw):

lib/matplotlib/quiver.py

Lines changed: 49 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -163,71 +163,6 @@
163163
quiverkey : Add a key to a quiver plot
164164
""" % docstring.interpd.params
165165

166-
_quiverkey_doc = """
167-
Add a key to a quiver plot.
168-
169-
Call signature::
170-
171-
quiverkey(Q, X, Y, U, label, **kw)
172-
173-
Arguments:
174-
175-
*Q*:
176-
The Quiver instance returned by a call to quiver.
177-
178-
*X*, *Y*:
179-
The location of the key; additional explanation follows.
180-
181-
*U*:
182-
The length of the key
183-
184-
*label*:
185-
A string with the length and units of the key
186-
187-
Keyword arguments:
188-
189-
*angle* = 0
190-
The angle of the key arrow. Measured in degrees anti-clockwise from the
191-
x-axis.
192-
193-
*coordinates* = [ 'axes' | 'figure' | 'data' | 'inches' ]
194-
Coordinate system and units for *X*, *Y*: 'axes' and 'figure' are
195-
normalized coordinate systems with 0,0 in the lower left and 1,1
196-
in the upper right; 'data' are the axes data coordinates (used for
197-
the locations of the vectors in the quiver plot itself); 'inches'
198-
is position in the figure in inches, with 0,0 at the lower left
199-
corner.
200-
201-
*color*:
202-
overrides face and edge colors from *Q*.
203-
204-
*labelpos* = [ 'N' | 'S' | 'E' | 'W' ]
205-
Position the label above, below, to the right, to the left of the
206-
arrow, respectively.
207-
208-
*labelsep*:
209-
Distance in inches between the arrow and the label. Default is
210-
0.1
211-
212-
*labelcolor*:
213-
defaults to default :class:`~matplotlib.text.Text` color.
214-
215-
*fontproperties*:
216-
A dictionary with keyword arguments accepted by the
217-
:class:`~matplotlib.font_manager.FontProperties` initializer:
218-
*family*, *style*, *variant*, *size*, *weight*
219-
220-
Any additional keyword arguments are used to override vector
221-
properties taken from *Q*.
222-
223-
The positioning of the key depends on *X*, *Y*, *coordinates*, and
224-
*labelpos*. If *labelpos* is 'N' or 'S', *X*, *Y* give the position
225-
of the middle of the key arrow. If *labelpos* is 'E', *X*, *Y*
226-
positions the head, and if *labelpos* is 'W', *X*, *Y* positions the
227-
tail; in either of these two cases, *X*, *Y* is somewhere in the
228-
middle of the arrow+label key object.
229-
"""
230-
231166

232167
class QuiverKey(martist.Artist):
233168
""" Labelled arrow for use as a quiver plot scale key."""
@@ -239,6 +174,52 @@ def __init__(self, Q, X, Y, U, label,
239174
*, angle=0, coordinates='axes', color=None, labelsep=0.1,
240175
labelpos='N', labelcolor=None, fontproperties=None,
241176
**kw):
177+
"""
178+
Add a key to a quiver plot.
179+
180+
Parameters
181+
----------
182+
Q : `Quiver`
183+
X, Y: scalar
184+
The location of the key.
185+
186+
The positioning of the key depends on *X*, *Y*, *coordinates*,
187+
and *labelpos*. If *labelpos* is 'N' or 'S', *X*, *Y* give the
188+
position of the middle of the key arrow. If *labelpos* is 'E',
189+
*X*, *Y* positions the head, and if *labelpos* is 'W', *X*, *Y*
190+
positions the tail; in either of these two cases, *X*, *Y* is
191+
somewhere in the middle of the arrow+label key object.
192+
U : scalar
193+
The length of the key
194+
label : str
195+
The key label (e.g., length and units of the key).
196+
angle : scalar, default: 0
197+
The angle of the key arrow, in degrees anti-clockwise from the
198+
x-axis.
199+
coordinates : {'axes', 'figure', 'data', 'inches'}, default: 'axes'
200+
Coordinate system and units for *X*, *Y*: 'axes' and 'figure' are
201+
normalized coordinate systems with 0,0 in the lower left and 1,1
202+
in the upper right; 'data' are the axes data coordinates (used for
203+
the locations of the vectors in the quiver plot itself); 'inches'
204+
is position in the figure in inches, with 0,0 at the lower left
205+
corner.
206+
color : color
207+
Overrides face and edge colors from *Q*.
208+
labelpos : {'N', 'S', 'E', 'W'}
209+
Position the label above, below, to the right, to the left of the
210+
arrow, respectively.
211+
labelsep : scalar, default: 0.1
212+
Distance in inches between the arrow and the label.
213+
labelcolor : color, default: :rc:`text.color`
214+
Label color.
215+
fontproperties : dict, optional
216+
A dictionary with keyword arguments accepted by the
217+
`~matplotlib.font_manager.FontProperties` initializer:
218+
*family*, *style*, *variant*, *size*, *weight*
219+
**kwargs
220+
Any additional keyword arguments are used to override vector
221+
properties taken from *Q*.
222+
"""
242223
martist.Artist.__init__(self)
243224
self.Q = Q
244225
self.X = X
@@ -292,8 +273,6 @@ def remove(self):
292273
# pass the remove call up the stack
293274
martist.Artist.remove(self)
294275

295-
__init__.__doc__ = _quiverkey_doc
296-
297276
def _init(self):
298277
if True: # not self._initialized:
299278
if not self.Q._initialized:
@@ -374,7 +353,9 @@ def contains(self, mouseevent):
374353
return True, {}
375354
return False, {}
376355

377-
quiverkey_doc = _quiverkey_doc
356+
@cbook.deprecated("3.2")
357+
def quiverkey_doc(self):
358+
return self.__init__.__doc__
378359

379360

380361
# This is a helper function that parses out the various combination of

0 commit comments

Comments
 (0)
0