File tree 2 files changed +14
-3
lines changed
Filter options
2 files changed +14
-3
lines changed
Original file line number Diff line number Diff line change @@ -529,11 +529,13 @@ def draw(self, renderer):
529
529
mcollections .PolyCollection .draw (self , renderer )
530
530
531
531
def set_UVC (self , U , V , C = None ):
532
- U = ma .masked_invalid (U , copy = False ).ravel ()
533
- V = ma .masked_invalid (V , copy = False ).ravel ()
532
+ # We need to ensure we have a copy, not a reference
533
+ # to an array that might change before draw().
534
+ U = ma .masked_invalid (U , copy = True ).ravel ()
535
+ V = ma .masked_invalid (V , copy = True ).ravel ()
534
536
mask = ma .mask_or (U .mask , V .mask , copy = False , shrink = True )
535
537
if C is not None :
536
- C = ma .masked_invalid (C , copy = False ).ravel ()
538
+ C = ma .masked_invalid (C , copy = True ).ravel ()
537
539
mask = ma .mask_or (mask , C .mask , copy = False , shrink = True )
538
540
if mask is ma .nomask :
539
541
C = C .filled ()
Original file line number Diff line number Diff line change @@ -83,6 +83,15 @@ def test_quiver_single():
83
83
ax .quiver ([1 ], [1 ], [2 ], [2 ])
84
84
85
85
86
+ @cleanup
87
+ def test_quiver_copy ():
88
+ fig , ax = plt .subplots ()
89
+ uv = dict (u = np .array ([1.1 ]), v = np .array ([2.0 ]))
90
+ q0 = ax .quiver ([1 ], [1 ], uv ['u' ], uv ['v' ])
91
+ uv ['v' ][0 ] = 0
92
+ assert q0 .V [0 ] == 2.0
93
+
94
+
86
95
if __name__ == '__main__' :
87
96
import nose
88
97
nose .runmodule ()
You can’t perform that action at this time.
0 commit comments