1818import weakref
1919
2020import numpy as np
21-
2221from numpy import ma
23- import matplotlib .collections as mcollections
24- import matplotlib .transforms as transforms
25- import matplotlib .text as mtext
22+
23+ from matplotlib import cbook , docstring , font_manager
2624import matplotlib .artist as martist
27- from matplotlib import docstring
28- import matplotlib .font_manager as font_manager
29- from matplotlib .cbook import delete_masked_points
25+ import matplotlib .collections as mcollections
3026from matplotlib .patches import CirclePolygon
27+ import matplotlib .text as mtext
28+ import matplotlib .transforms as transforms
3129
3230
3331_quiver_doc = """
@@ -380,7 +378,7 @@ def contains(self, mouseevent):
380378# arguments for doing colored vector plots. Pulling it out here
381379# allows both Quiver and Barbs to use it
382380def _parse_args (* args ):
383- X , Y , U , V , C = [ None ] * 5
381+ X = Y = U = V = C = None
384382 args = list (args )
385383
386384 # The use of atleast_1d allows for handling scalar arguments while also
@@ -389,6 +387,7 @@ def _parse_args(*args):
389387 C = np .atleast_1d (args .pop (- 1 ))
390388 V = np .atleast_1d (args .pop (- 1 ))
391389 U = np .atleast_1d (args .pop (- 1 ))
390+ cbook ._check_not_matrix (U = U , V = V , C = C )
392391 if U .ndim == 1 :
393392 nr , nc = 1 , U .shape [0 ]
394393 else :
@@ -1144,13 +1143,12 @@ def set_UVC(self, U, V, C=None):
11441143 self .v = ma .masked_invalid (V , copy = False ).ravel ()
11451144 if C is not None :
11461145 c = ma .masked_invalid (C , copy = False ).ravel ()
1147- x , y , u , v , c = delete_masked_points (self .x .ravel (),
1148- self .y .ravel (),
1149- self .u , self .v , c )
1146+ x , y , u , v , c = cbook .delete_masked_points (
1147+ self .x .ravel (), self .y .ravel (), self .u , self .v , c )
11501148 _check_consistent_shapes (x , y , u , v , c )
11511149 else :
1152- x , y , u , v = delete_masked_points (self . x . ravel (), self . y . ravel (),
1153- self .u , self .v )
1150+ x , y , u , v = cbook . delete_masked_points (
1151+ self . x . ravel (), self . y . ravel (), self .u , self .v )
11541152 _check_consistent_shapes (x , y , u , v )
11551153
11561154 magnitude = np .hypot (u , v )
@@ -1186,8 +1184,8 @@ def set_offsets(self, xy):
11861184 """
11871185 self .x = xy [:, 0 ]
11881186 self .y = xy [:, 1 ]
1189- x , y , u , v = delete_masked_points (self . x . ravel (), self . y . ravel (),
1190- self .u , self .v )
1187+ x , y , u , v = cbook . delete_masked_points (
1188+ self . x . ravel (), self . y . ravel (), self .u , self .v )
11911189 _check_consistent_shapes (x , y , u , v )
11921190 xy = np .column_stack ((x , y ))
11931191 mcollections .PolyCollection .set_offsets (self , xy )
0 commit comments