163
163
quiverkey : Add a key to a quiver plot
164
164
""" % docstring .interpd .params
165
165
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
-
231
166
232
167
class QuiverKey (martist .Artist ):
233
- """ Labelled arrow for use as a quiver plot scale key."""
168
+ """Labelled arrow for use as a quiver plot scale key."""
234
169
halign = {'N' : 'center' , 'S' : 'center' , 'E' : 'left' , 'W' : 'right' }
235
170
valign = {'N' : 'bottom' , 'S' : 'top' , 'E' : 'center' , 'W' : 'center' }
236
171
pivot = {'N' : 'middle' , 'S' : 'middle' , 'E' : 'tip' , 'W' : 'tail' }
@@ -239,6 +174,52 @@ def __init__(self, Q, X, Y, U, label,
239
174
* , angle = 0 , coordinates = 'axes' , color = None , labelsep = 0.1 ,
240
175
labelpos = 'N' , labelcolor = None , fontproperties = None ,
241
176
** 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
+
A3E2
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
+ """
242
223
martist .Artist .__init__ (self )
243
224
self .Q = Q
244
225
self .X = X
@@ -292,8 +273,6 @@ def remove(self):
292
273
# pass the remove call up the stack
293
274
martist .Artist .remove (self )
294
275
295
- __init__ .__doc__ = _quiverkey_doc
296
-
297
276
def _init (self ):
298
277
if True : # not self._initialized:
299
278
if not self .Q ._initialized :
@@ -374,7 +353,9 @@ def contains(self, mouseevent):
374
353
return True , {}
375
354
return False , {}
376
355
377
- quiverkey_doc = _quiverkey_doc
356
+ @cbook .deprecated ("3.2" )
357
+ def quiverkey_doc (self ):
358
+ return self .__init__ .__doc__
378
359
379
360
380
361
# This is a helper function that parses out the various combination of
@@ -690,7 +671,7 @@ def _make_verts(self, U, V, angles):
690
671
return XY
691
672
692
673
def _h_arrows (self , length ):
693
- """ length is in arrow width units """
674
+ """Length is in arrow width units. """
694
675
# It might be possible to streamline the code
695
676
# and speed it up a bit by using complex (x,y)
696
677
# instead of separate arrays; but any gain would be slight.
0 commit comments