@@ -5524,19 +5524,14 @@ def pcolormesh(self, *args, **kwargs):
5524
5524
X , Y , C = self ._pcolorargs ('pcolormesh' , * args , allmatch = allmatch )
5525
5525
Ny , Nx = X .shape
5526
5526
5527
- # convert to one dimensional arrays
5528
- C = C .ravel ()
5529
- X = X .ravel ()
5530
- Y = Y .ravel ()
5531
-
5532
5527
# unit conversion allows e.g. datetime objects as axis values
5533
5528
self ._process_unit_info (xdata = X , ydata = Y , kwargs = kwargs )
5534
5529
X = self .convert_xunits (X )
5535
5530
Y = self .convert_yunits (Y )
5536
5531
5537
- coords = np . zeros ((( Nx * Ny ), 2 ), dtype = float )
5538
- coords [:, 0 ] = X
5539
- coords [:, 1 ] = Y
5532
+ # convert to one dimensional arrays
5533
+ C = C . ravel ()
5534
+ coords = np . column_stack (( X . flat , Y . flat )). astype ( float , copy = False )
5540
5535
5541
5536
collection = mcoll .QuadMesh (Nx - 1 , Ny - 1 , coords ,
5542
5537
antialiased = antialiased , shading = shading ,
@@ -5561,17 +5556,12 @@ def pcolormesh(self, *args, **kwargs):
5561
5556
5562
5557
if t and any (t .contains_branch_seperately (self .transData )):
5563
5558
trans_to_data = t - self .transData
5564
- pts = np .vstack ([X , Y ]).T .astype (float )
5565
- transformed_pts = trans_to_data .transform (pts )
5566
- X = transformed_pts [..., 0 ]
5567
- Y = transformed_pts [..., 1 ]
5559
+ coords = trans_to_data .transform (coords )
5568
5560
5569
5561
self .add_collection (collection , autolim = False )
5570
5562
5571
- minx = np .min (X )
5572
- maxx = np .max (X )
5573
- miny = np .min (Y )
5574
- maxy = np .max (Y )
5563
+ minx , miny = np .min (coords , axis = 0 )
5564
+ maxx , maxy = np .max (coords , axis = 0 )
5575
5565
collection .sticky_edges .x [:] = [minx , maxx ]
5576
5566
collection .sticky_edges .y [:] = [miny , maxy ]
5577
5567
corners = (minx , miny ), (maxx , maxy )
0 commit comments