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,53 @@ 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
+ The positioning of the key depends on *X*, *Y*, *coordinates*, and
181
+ *labelpos*. If *labelpos* is 'N' or 'S', *X*, *Y* give the position of
182
+ the middle of the key arrow. If *labelpos* is 'E', *X*, *Y* positions
183
+ the head, and if *labelpos* is 'W', *X*, *Y* positions the tail; in
184
+ either of these two cases, *X*, *Y* is somewhere in the middle of the
185
+ arrow+label key object.
186
+
187
+ Parameters
188
+ ----------
189
+ Q : `Quiver`
190
+ A `Quiver` object as returned by a call to `~Axes.quiver()`.
191
+ X, Y: float
192
+ The location of the key.
193
+ U : float
194
+ The length of the key
195
+ label : str
196
+ The key label (e.g., length and units of the key).
197
+ angle : float, default: 0
198
+ The angle of the key arrow, in degrees anti-clockwise from the
199
+ x-axis.
200
+ coordinates : {'axes', 'figure', 'data', 'inches'}, default: 'axes'
201
+ Coordinate system and units for *X*, *Y*: 'axes' and 'figure' are
202
+ normalized coordinate systems with 0,0 in the lower left and 1,1
203
+ in the upper right; 'data' are the axes data coordinates (used for
204
+ the locations of the vectors in the quiver plot itself); 'inches'
205
+ is position in the figure in inches, with 0,0 at the lower left
206
+ corner.
207
+ color : color
208
+ Overrides face and edge colors from *Q*.
209
+ labelpos : {'N', 'S', 'E', 'W'}
210
+ Position the label above, below, to the right, to the left of the
211
+ arrow, respectively.
212
+ labelsep : float, default: 0.1
213
+ Distance in inches between the arrow and the label.
214
+ labelcolor : color, default: :rc:`text.color`
215
+ Label color.
216
+ fontproperties : dict, optional
217
+ A dictionary with keyword arguments accepted by the
218
+ `~matplotlib.font_manager.FontProperties` initializer:
219
+ *family*, *style*, *variant*, *size*, *weight*
220
+ **kwargs
221
+ Any additional keyword arguments are used to override vector
222
+ properties taken from *Q*.
223
+ """
242
224
martist .Artist .__init__ (self )
243
225
self .Q = Q
244
226
self .X = X
@@ -292,8 +274,6 @@ def remove(self):
292
274
# pass the remove call up the stack
293
275
martist .Artist .remove (self )
294
276
295
- __init__ .__doc__ = _quiverkey_doc
296
-
297
277
def _init (self ):
298
278
if True : # not self._initialized:
299
279
if not self .Q ._initialized :
@@ -374,7 +354,10 @@ def contains(self, mouseevent):
374
354
return True , {}
375
355
return False , {}
376
356
377
- quiverkey_doc = _quiverkey_doc
357
+ @cbook .deprecated ("3.2" )
358
+ @property
359
+ def quiverkey_doc (self ):
360
+ return self .__init__ .__doc__
378
361
379
362
380
363
# This is a helper function that parses out the various combination of
@@ -690,7 +673,7 @@ def _make_verts(self, U, V, angles):
690
673
return XY
691
674
692
675
def _h_arrows (self , length ):
693
- """ length is in arrow width units """
676
+ """Length is in arrow width units. """
694
677
# It might be possible to streamline the code
695
678
# and speed it up a bit by using complex (x,y)
696
679
# instead of separate arrays; but any gain would be slight.
0 commit comments