@@ -146,7 +146,7 @@ def __init__(self,
146146 self ._uniform_offsets = None
147147 self ._offsets = np .array ([[0 , 0 ]], float )
148148 if offsets is not None :
149- offsets = np .asanyarray (offsets ). reshape (( - 1 , 2 ) )
149+ offsets = np .asanyarray (offsets , float )
150150 if transOffset is not None :
151151 self ._offsets = offsets
152152 self ._transOffset = transOffset
@@ -186,7 +186,6 @@ def get_datalim(self, transData):
186186 offsets = transOffset .transform_non_affine (offsets )
187187 transOffset = transOffset .get_affine ()
188188
189- offsets = np .asanyarray (offsets , float ).reshape ((- 1 , 2 ))
190189 if isinstance (offsets , np .ma .MaskedArray ):
191190 offsets = offsets .filled (np .nan )
192191 # get_path_collection_extents handles nan but not masked arrays
@@ -220,14 +219,12 @@ def _prepare_points(self):
220219 xs , ys = vertices [:, 0 ], vertices [:, 1 ]
221220 xs = self .convert_xunits (xs )
222221 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 ))
224223
225224 if offsets .size > 0 :
226225 xs = self .convert_xunits (offsets [:, 0 ])
227226 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 ])
231228
232229 if not transform .is_affine :
233230 paths = [transform .transform_path_non_affine (path )
@@ -413,7 +410,7 @@ def set_offsets(self, offsets):
413410
414411 ACCEPTS: float or sequence of floats
415412 """
416- offsets = np .asanyarray (offsets , float ). reshape (( - 1 , 2 ))
413+ offsets = np .asanyarray (offsets , float )
417414 #This decision is based on how they are initialized above
418415 if self ._uniform_offsets is None :
419416 self ._offsets = offsets
@@ -1869,17 +1866,12 @@ def draw(self, renderer):
18691866 if len (self ._offsets ):
18701867 xs = self .convert_xunits (self ._offsets [:, 0 ])
18711868 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 ])
18751870
18761871 self .update_scalarmappable ()
18771872
18781873 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 ))
18831875 coordinates = transform .transform (coordinates )
18841876 coordinates = coordinates .reshape (self ._coordinates .shape )
18851877 transform = transforms .IdentityTransform ()
0 commit comments