18
18
import weakref
19
19
20
20
import numpy as np
21
-
22
21
from 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
26
24
import 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
30
26
from matplotlib .patches import CirclePolygon
27
+ import matplotlib .text as mtext
28
+ import matplotlib .transforms as transforms
31
29
32
30
33
31
_quiver_doc = """
@@ -380,7 +378,7 @@ def contains(self, mouseevent):
380
378
# arguments for doing colored vector plots. Pulling it out here
381
379
# allows both Quiver and Barbs to use it
382
380
def _parse_args (* args ):
383
- X , Y , U , V , C = [ None ] * 5
381
+ X = Y = U = V = C = None
384
382
args = list (args )
385
383
386
384
# The use of atleast_1d allows for handling scalar arguments while also
@@ -389,6 +387,7 @@ def _parse_args(*args):
389
387
C = np .atleast_1d (args .pop (- 1 ))
390
388
V = np .atleast_1d (args .pop (- 1 ))
391
389
U = np .atleast_1d (args .pop (- 1 ))
390
+ cbook ._check_not_matrix (U = U , V = V , C = C )
392
391
if U .ndim == 1 :
393
392
nr , nc = 1 , U .shape [0 ]
394
393
else :
@@ -1144,13 +1143,12 @@ def set_UVC(self, U, V, C=None):
1144
1143
self .v = ma .masked_invalid (V , copy = False ).ravel ()
1145
1144
if C is not None :
1146
1145
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 )
1150
1148
_check_consistent_shapes (x , y , u , v , c )
1151
1149
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 )
1154
1152
_check_consistent_shapes (x , y , u , v )
1155
1153
1156
1154
magnitude = np .hypot (u , v )
@@ -1186,8 +1184,8 @@ def set_offsets(self, xy):
1186
1184
"""
1187
1185
self .x = xy [:, 0 ]
1188
1186
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 )
1191
1189
_check_consistent_shapes (x , y , u , v )
1192
1190
xy = np .column_stack ((x , y ))
1193
1191
mcollections .PolyCollection .set_offsets (self , xy )
0 commit comments