@@ -454,11 +454,10 @@ class Quiver(mcollections.PolyCollection):
454454 """
455455 Specialized PolyCollection for arrows.
456456
457- The API methods are set_UVC(), set_U(), set_V() and set_C(), which
458- can be used to change the size, orientation, and color of the
459- arrows; their locations are fixed when the class is
460- instantiated. Possibly these methods will be useful
461- in animations.
457+ The API methods are set_XYUVC(), set_X(), set_Y(), set_U() and set_V(),
458+ which can be used to change the size, orientation, and color of the
459+ arrows; their locations are fixed when the class is instantiated.
460+ Possibly these methods will be useful in animations.
462461
463462 Much of the work in this class is done in the draw()
464463 method so that as much information as possible is available
@@ -512,7 +511,7 @@ def __init__(self, ax, *args,
512511 X , Y , U , V , C , self ._nr , self ._nc = _parse_args (
513512 * args , caller_name = 'quiver()'
514513 )
515- self .set_XYUVC (X = X , Y = Y , U = U , V = V , C = C )
514+ self .set_XYUVC (X = X , Y = Y , U = U , V = V , C = C , check_shape = True )
516515 self ._dpi_at_last_init = None
517516
518517 def _init (self ):
@@ -547,59 +546,49 @@ def X(self):
547546 return self .get_X ()
548547
549548 @X .setter
550- def X (self ):
549+ def X (self , value ):
551550 _api .warn_deprecated ("3.9" , alternative = "set_X" )
552- return self .set_X ()
551+ return self .set_X (value )
553552
554553 @property
555554 def Y (self ):
556555 _api .warn_deprecated ("3.9" , alternative = "get_Y" )
557556 return self .get_Y ()
558557
559558 @Y .setter
560- def Y (self ):
559+ def Y (self , value ):
561560 _api .warn_deprecated ("3.9" , alternative = "set_Y" )
562- return self .set_Y ()
561+ return self .set_Y (value )
563562
564563 @property
565564 def U (self ):
566565 _api .warn_deprecated ("3.9" , alternative = "get_U" )
567566 return self .get_U ()
568567
569568 @U .setter
570- def U (self ):
569+ def U (self , value ):
571570 _api .warn_deprecated ("3.9" , alternative = "set_U" )
572- return self .set_U ()
571+ return self .set_U (value )
573572
574573 @property
575574 def V (self ):
576575 _api .warn_deprecated ("3.9" , alternative = "get_V" )
577576 return self .get_V ()
578577
579578 @V .setter
580- def V (self ):
579+ def V (self , value ):
581580 _api .warn_deprecated ("3.9" , alternative = "set_V" )
582- return self .set_V ()
583-
584- @property
585- def C (self ):
586- _api .warn_deprecated ("3.9" , alternative = "get_C" )
587- return self .get_C ()
588-
589- @C .setter
590- def C (self ):
591- _api .warn_deprecated ("3.9" , alternative = "set_C" )
592- return self .set_C ()
581+ return self .set_V (value )
593582
594583 @property
595584 def XY (self ):
596- _api .warn_deprecated ("3.9" , alternative = "get_XY " )
585+ _api .warn_deprecated ("3.9" , alternative = "get_offsets " )
597586 return self .get_offsets ()
598587
599588 @XY .setter
600- def XY (self , XY ):
601- _api .warn_deprecated ("3.9" , alternative = "set_XY " )
602- self .set_offsets (offsets = XY )
589+ def XY (self , value ):
590+ _api .warn_deprecated ("3.9" , alternative = "set_offsets " )
591+ self .set_offsets (offsets = value )
603592
604593 def set_offsets (self , offsets ):
605594 self .set_XYUVC (X = offsets [:, 0 ], Y = offsets [:, 1 ])
@@ -621,23 +610,6 @@ def draw(self, renderer):
621610 super ().draw (renderer )
622611 self .stale = False
623612
624- def get_XY (self ):
625- """Returns the positions. Alias for ``get_offsets``."""
626- return self .get_offsets ()
627-
628- def set_XY (self , XY ):
629- """
630- Set positions. Alias for ``set_offsets``. If the size
631- changes and it is not compatible with ``U``, ``V`` or
632- ``C``, use ``set_XYUVC`` instead.
633-
634- Parameters
635- ----------
636- X : array-like
637- The size must be compatible with ``U``, ``V`` and ``C``.
638- """
639- self .set_offsets (offsets = XY )
640-
641613 def set_X (self , X ):
642614 """
643615 Set positions in the horizontal direction.
@@ -698,22 +670,7 @@ def get_V(self):
698670 """Returns the vertical direction components."""
699671 return self ._V
700672
701- def set_C (self , C ):
702- """
703- Set the arrow colors.
704-
705- Parameters
706- ----------
707- C : array-like
708- The size must the same as the existing X, Y, U, V or be one.
709- """
710- self .set_XYUVC (C = C )
711-
712- def get_C (self ):
713- """Returns the arrow colors."""
714- return self ._C
715-
716- def set_XYUVC (self , X = None , Y = None , U = None , V = None , C = None ):
673+ def set_XYUVC (self , X = None , Y = None , U = None , V = None , C = None , check_shape = False ):
717674 """
718675 Set the positions (X, Y) and components (U, V) of the arrow vectors
719676 and arrow colors (C) values of the arrows.
@@ -733,6 +690,9 @@ def set_XYUVC(self, X=None, Y=None, U=None, V=None, C=None):
733690 C : array-like or None, optional
734691 The arrow colors. The default is None.
735692 The size must the same as the existing U, V or be one.
693+ check_shape : bool
694+ Whether to check if the shape of the parameters are
695+ consistent. Default is False.
736696 """
737697
738698 X = self .get_X () if X is None else X
@@ -752,13 +712,14 @@ def set_XYUVC(self, X=None, Y=None, U=None, V=None, C=None):
752712 C = ma .masked_invalid (
753713 self ._C if C is None else C , copy = True
754714 ).ravel ()
755- for name , var in zip (('U' , 'V' , 'C' ), (U , V , C )):
756- if not (var is None or var .size == N or var .size == 1 ):
757- raise ValueError (
758- f'Argument { name } has a size { var .size } '
759- f' which does not match { N } ,'
760- ' the number of arrow positions'
761- )
715+ if check_shape :
716+ for name , var in zip (('U' , 'V' , 'C' ), (U , V , C )):
717+ if not (var is None or var .size == N or var .size == 1 ):
718+ raise ValueError (
719+ f'Argument { name } has a size { var .size } '
720+ f' which does not match { N } ,'
721+ ' the number of arrow positions'
722+ )
762723
763724 # now shapes are validated and we can start assigning things
764725 mask = ma .mask_or (U .mask , V .mask , copy = False , shrink = True )
0 commit comments