@@ -146,7 +146,7 @@ def __init__(self,
146
146
self ._uniform_offsets = None
147
147
self ._offsets = np .array ([[0 , 0 ]], float )
148
148
if offsets is not None :
149
- offsets = np .asanyarray (offsets ). reshape (( - 1 , 2 ) )
149
+ offsets = np .asanyarray (offsets , float )
150
150
if transOffset is not None :
151
151
self ._offsets = offsets
152
152
self ._transOffset = transOffset
@@ -186,7 +186,6 @@ def get_datalim(self, transData):
186
186
offsets = transOffset .transform_non_affine (offsets )
187
187
transOffset = transOffset .get_affine ()
188
188
189
- offsets = np .asanyarray (offsets , float ).reshape ((- 1 , 2 ))
190
189
if isinstance (offsets , np .ma .MaskedArray ):
191
190
offsets = offsets .filled (np .nan )
192
191
# get_path_collection_extents handles nan but not masked arrays
@@ -220,14 +219,12 @@ def _prepare_points(self):
220
219
xs , ys = vertices [:, 0 ], vertices [:, 1 ]
221
220
xs = self .convert_xunits (xs )
222
221
ys = self .convert_yunits (ys )
223
- paths .append (mpath .Path (list ( zip ( xs , ys ) ), path .codes ))
222
+ paths .append (mpath .Path (np . column_stack ([ xs , ys ] ), path .codes ))
224
223
225
224
if offsets .size > 0 :
226
225
xs = self .convert_xunits (offsets [:, 0 ])
227
226
ys = self .convert_yunits (offsets [:, 1 ])
228
- offsets = list (zip (xs , ys ))
229
-
230
- offsets = np .asanyarray (offsets , float ).reshape ((- 1 , 2 ))
227
+ offsets = np .column_stack ([xs , ys ])
231
228
232
229
if not transform .is_affine :
233
230
paths = [transform .transform_path_non_affine (path )
@@ -413,7 +410,7 @@ def set_offsets(self, offsets):
413
410
414
411
ACCEPTS: float or sequence of floats
415
412
"""
416
- offsets = np .asanyarray (offsets , float ). reshape (( - 1 , 2 ))
413
+ offsets = np .asanyarray (offsets , float )
417
414
#This decision is based on how they are initialized above
418
415
if self ._uniform_offsets is None :
419
416
self ._offsets = offsets
@@ -1869,17 +1866,12 @@ def draw(self, renderer):
1869
1866
if len (self ._offsets ):
1870
1867
xs = self .convert_xunits (self ._offsets [:, 0 ])
1871
1868
ys = self .convert_yunits (self ._offsets [:, 1 ])
1872
- offsets = list (zip (xs , ys ))
1873
-
1874
- offsets = np .asarray (offsets , float ).reshape ((- 1 , 2 ))
1869
+ offsets = np .column_stack ([xs , ys ])
1875
1870
1876
1871
self .update_scalarmappable ()
1877
1872
1878
1873
if not transform .is_affine :
1879
- coordinates = self ._coordinates .reshape (
1880
- (self ._coordinates .shape [0 ] *
1881
- self ._coordinates .shape [1 ],
1882
- 2 ))
1874
+ coordinates = self ._coordinates .reshape ((- 1 , 2 ))
1883
1875
coordinates = transform .transform (coordinates )
1884
1876
coordinates = coordinates .reshape (self ._coordinates .shape )
1885
1877
transform = transforms .IdentityTransform ()
0 commit comments