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 = """
@@ -381,7 +379,7 @@ def contains(self, mouseevent):
381379# arguments for doing colored vector plots. Pulling it out here
382380# allows both Quiver and Barbs to use it
383381def _parse_args (* args ):
384- X , Y , U , V , C = [ None ] * 5
382+ X = Y = U = V = C = None
385383 args = list (args )
386384
387385 # The use of atleast_1d allows for handling scalar arguments while also
@@ -390,6 +388,7 @@ def _parse_args(*args):
390388 C = np .atleast_1d (args .pop (- 1 ))
391389 V = np .atleast_1d (args .pop (- 1 ))
392390 U = np .atleast_1d (args .pop (- 1 ))
391+ cbook ._check_not_matrix (U = U , V = V , C = C )
393392 if U .ndim == 1 :
394393 nr , nc = 1 , U .shape [0 ]
395394 else :
@@ -1145,13 +1144,12 @@ def set_UVC(self, U, V, C=None):
11451144 self .v = ma .masked_invalid (V , copy = False ).ravel ()
11461145 if C is not None :
11471146 c = ma .masked_invalid (C , copy = False ).ravel ()
1148- x , y , u , v , c = delete_masked_points (self .x .ravel (),
1149- self .y .ravel (),
1150- self .u , self .v , c )
1147+ x , y , u , v , c = cbook .delete_masked_points (
1148+ self .x .ravel (), self .y .ravel (), self .u , self .v , c )
11511149 _check_consistent_shapes (x , y , u , v , c )
11521150 else :
1153- x , y , u , v = delete_masked_points (self . x . ravel (), self . y . ravel (),
1154- self .u , self .v )
1151+ x , y , u , v = cbook . delete_masked_points (
1152+ self . x . ravel (), self . y . ravel (), self .u , self .v )
11551153 _check_consistent_shapes (x , y , u , v )
11561154
11571155 magnitude = np .hypot (u , v )
@@ -1187,8 +1185,8 @@ def set_offsets(self, xy):
11871185 """
11881186 self .x = xy [:, 0 ]
11891187 self .y = xy [:, 1 ]
1190- x , y , u , v = delete_masked_points (self . x . ravel (), self . y . ravel (),
1191- self .u , self .v )
1188+ x , y , u , v = cbook . delete_masked_points (
1189+ self . x . ravel (), self . y . ravel (), self .u , self .v )
11921190 _check_consistent_shapes (x , y , u , v )
11931191 xy = np .column_stack ((x , y ))
11941192 mcollections .PolyCollection .set_offsets (self , xy )
0 commit comments