136136 is less than this, plot a dot (hexagon) of this diameter instead.
137137 Default is 1.
138138
139- *pivot*: [ 'tail' | 'middle' | 'tip' ]
139+ *pivot*: [ 'tail' | 'mid' | ' middle' | 'tip' ]
140140 The part of the arrow that is at the grid point; the arrow rotates
141141 about this point, hence the name *pivot*.
142142
@@ -405,6 +405,8 @@ class Quiver(mcollections.PolyCollection):
405405 in the draw() method.
406406 """
407407
408+ _PIVOT_VALS = ('tail' , 'mid' , 'middle' , 'tip' )
409+
408410 @docstring .Substitution (_quiver_doc )
409411 def __init__ (self , ax , * args , ** kw ):
410412 """
@@ -430,7 +432,18 @@ def __init__(self, ax, *args, **kw):
430432 self .angles = kw .pop ('angles' , 'uv' )
431433 self .width = kw .pop ('width' , None )
432434 self .color = kw .pop ('color' , 'k' )
433- self .pivot = kw .pop ('pivot' , 'tail' )
435+
436+ pivot = kw .pop ('pivot' , 'tail' ).lower ()
437+ # validate pivot
438+ if pivot not in self ._PIVOT_VALS :
439+ raise ValueError (
440+ 'pivot must be one of {keys}, you passed {inp}' .format (
441+ keys = self ._PIVOT_VALS , inp = pivot ))
442+ # normalize to 'middle'
443+ if pivot == 'mid' :
444+ pivot = 'middle'
445+ self .pivot = pivot
446+
434447 self .transform = kw .pop ('transform' , ax .transData )
435448 kw .setdefault ('facecolors' , self .color )
436449 kw .setdefault ('linewidths' , (0 ,))
@@ -681,9 +694,9 @@ def _h_arrows(self, length):
681694 # Now select X0, Y0 if short, otherwise X, Y
682695 cbook ._putmask (X , short , X0 )
683696 cbook ._putmask (Y , short , Y0 )
684- if self .pivot [: 3 ] == 'mid ' :
697+ if self .pivot == 'middle ' :
685698 X -= 0.5 * X [:, 3 , np .newaxis ]
686- elif self .pivot [: 3 ] == 'tip' :
699+ elif self .pivot == 'tip' :
687700 X = X - X [:, 3 , np .newaxis ] # numpy bug? using -= does not
688701 # work here unless we multiply
689702 # by a float first, as with 'mid'.
0 commit comments