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 = """
@@ -381,7 +379,7 @@ def contains(self, mouseevent):
381
379
# arguments for doing colored vector plots. Pulling it out here
382
380
# allows both Quiver and Barbs to use it
383
381
def _parse_args (* args ):
384
- X , Y , U , V , C = [ None ] * 5
382
+ X = Y = U = V = C = None
385
383
args = list (args )
386
384
387
385
# The use of atleast_1d allows for handling scalar arguments while also
@@ -390,6 +388,7 @@ def _parse_args(*args):
390
388
C = np .atleast_1d (args .pop (- 1 ))
391
389
V = np .atleast_1d (args .pop (- 1 ))
392
390
U = np .atleast_1d (args .pop (- 1 ))
391
+ cbook ._check_not_matrix (U = U , V = V , C = C )
393
392
if U .ndim == 1 :
394
393
nr , nc = 1 , U .shape [0 ]
395
394
else :
@@ -1145,13 +1144,12 @@ def set_UVC(self, U, V, C=None):
1145
1144
self .v = ma .masked_invalid (V , copy = False ).ravel ()
1146
1145
if C is not None :
1147
1146
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 )
1151
1149
_check_consistent_shapes (x , y , u , v , c )
1152
1150
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 )
1155
1153
_check_consistent_shapes (x , y , u , v )
1156
1154
1157
1155
magnitude = np .hypot (u , v )
@@ -1187,8 +1185,8 @@ def set_offsets(self, xy):
1187
1185
"""
1188
1186
self .x = xy [:, 0 ]
1189
1187
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 )
1192
1190
_check_consistent_shapes (x , y , u , v )
1193
1191
xy = np .column_stack ((x , y ))
1194
1192
mcollections .PolyCollection .set_offsets (self , xy )
0 commit comments