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