@@ -145,7 +145,7 @@ def __init__(self,
145
145
self ._uniform_offsets = None
146
146
self ._offsets = np .array ([[0 , 0 ]], float )
147
147
if offsets is not None :
148
- offsets = np .asanyarray (offsets ). reshape (( - 1 , 2 ) )
148
+ offsets = np .asanyarray (offsets , float )
149
149
if transOffset is not None :
150
150
self ._offsets = offsets
151
151
self ._transOffset = transOffset
@@ -210,7 +210,6 @@ def get_datalim(self, transData):
210
210
offsets = transOffset .transform_non_affine (offsets )
211
211
transOffset = transOffset .get_affine ()
212
212
213
- offsets = np .asanyarray (offsets , float ).reshape ((- 1 , 2 ))
214
213
if isinstance (offsets , np .ma .MaskedArray ):
215
214
offsets = offsets .filled (np .nan )
216
215
# get_path_collection_extents handles nan but not masked arrays
@@ -244,14 +243,12 @@ def _prepare_points(self):
244
243
xs , ys = vertices [:, 0 ], vertices [:, 1 ]
245
244
xs = self .convert_xunits (xs )
246
245
ys = self .convert_yunits (ys )
247
- paths .append (mpath .Path (list ( zip ( xs , ys ) ), path .codes ))
246
+ paths .append (mpath .Path (np . column_stack ([ xs , ys ] ), path .codes ))
248
247
249
248
if offsets .size > 0 :
250
249
xs = self .convert_xunits (offsets [:, 0 ])
251
250
ys = self .convert_yunits (offsets [:, 1 ])
252
- offsets = list (zip (xs , ys ))
253
-
254
- offsets = np .asanyarray (offsets , float ).reshape ((- 1 , 2 ))
251
+ offsets = np .column_stack ([xs , ys ])
255
252
256
253
if not transform .is_affine :
257
254
paths = [transform .transform_path_non_affine (path )
@@ -431,7 +428,7 @@ def set_offsets(self, offsets):
431
428
432
429
ACCEPTS: float or sequence of floats
433
430
"""
434
- offsets = np .asanyarray (offsets , float ). reshape (( - 1 , 2 ))
431
+ offsets = np .asanyarray (offsets , float )
435
432
#This decision is based on how they are initialized above
436
433
if self ._uniform_offsets is None :
437
434
self ._offsets = offsets
@@ -1881,17 +1878,12 @@ def draw(self, renderer):
1881
1878
if len (self ._offsets ):
1882
1879
xs = self .convert_xunits (self ._offsets [:, 0 ])
1883
1880
ys = self .convert_yunits (self ._offsets [:, 1 ])
1884
- offsets = list (zip (xs , ys ))
1885
-
1886
- offsets = np .asarray (offsets , float ).reshape ((- 1 , 2 ))
1881
+ offsets = np .column_stack ([xs , ys ])
1887
1882
1888
1883
self .update_scalarmappable ()
1889
1884
1890
1885
if not transform .is_affine :
1891
- coordinates = self ._coordinates .reshape (
1892
- (self ._coordinates .shape [0 ] *
1893
- self ._coordinates .shape [1 ],
1894
- 2 ))
1886
+ coordinates = self ._coordinates .reshape ((- 1 , 2 ))
1895
1887
coordinates = transform .transform (coordinates )
1896
1888
coordinates = coordinates .reshape (self ._coordinates .shape )
1897
1889
transform = transforms .IdentityTransform ()
0 commit comments