@@ -6231,30 +6231,8 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
6231
6231
collection ._check_exclusionary_keywords (colorizer , vmin = vmin , vmax = vmax )
6232
6232
collection ._scale_norm (norm , vmin , vmax )
6233
6233
6234
- # Transform from native to data coordinates?
6235
- t = collection ._transform
6236
- if (not isinstance (t , mtransforms .Transform ) and
6237
- hasattr (t , '_as_mpl_transform' )):
6238
- t = t ._as_mpl_transform (self .axes )
6239
-
6240
- if t and any (t .contains_branch_seperately (self .transData )):
6241
- trans_to_data = t - self .transData
6242
- pts = np .vstack ([x , y ]).T .astype (float )
6243
- transformed_pts = trans_to_data .transform (pts )
6244
- x = transformed_pts [..., 0 ]
6245
- y = transformed_pts [..., 1 ]
6246
-
6247
- self .add_collection (collection , autolim = False )
6248
-
6249
- minx = np .min (x )
6250
- maxx = np .max (x )
6251
- miny = np .min (y )
6252
- maxy = np .max (y )
6253
- collection .sticky_edges .x [:] = [minx , maxx ]
6254
- collection .sticky_edges .y [:] = [miny , maxy ]
6255
- corners = (minx , miny ), (maxx , maxy )
6256
- self .update_datalim (corners )
6257
- self ._request_autoscale_view ()
6234
+
10000
coords = coords .reshape (- 1 , 2 ) # flatten the grid structure; keep x, y
6235
+ self ._update_pcolor_lims (collection , coords )
6258
6236
return collection
6259
6237
6260
6238
@_preprocess_data ()
@@ -6464,7 +6442,13 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
6464
6442
collection ._scale_norm (norm , vmin , vmax )
6465
6443
6466
6444
coords = coords .reshape (- 1 , 2 ) # flatten the grid structure; keep x, y
6445
+ self ._update_pcolor_lims (collection , coords )
6446
+ return collection
6467
6447
6448
+ def _update_pcolor_lims (self , collection , coords ):
6449
+ """
6450
+ Common code for updating lims in pcolor() and pcolormesh() methods.
6451
+ """
6468
6452
# Transform from native to data coordinates?
6469
6453
t = collection ._transform
6470
6454
if (not isinstance (t , mtransforms .Transform ) and
@@ -6481,10 +6465,8 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
6481
6465
maxx , maxy = np .max (coords , axis = 0 )
6482
6466
collection .sticky_edges .x [:] = [minx , maxx ]
6483
6467
collection .sticky_edges .y [:] = [miny , maxy ]
6484
- corners = (minx , miny ), (maxx , maxy )
6485
- self .update_datalim (corners )
6468
+ self .update_datalim (coords )
6486
6469
self ._request_autoscale_view ()
6487
- return collection
6488
6470
6489
6471
@_preprocess_data ()
6490
6472
@_docstring .interpd
0 commit comments