@@ -6232,25 +6232,7 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
62326232 collection ._scale_norm (norm , vmin , vmax )
62336233
62346234 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 )
62546236 return collection
62556237
62566238 @_preprocess_data ()
@@ -6460,7 +6442,13 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
64606442 collection ._scale_norm (norm , vmin , vmax )
64616443
64626444 coords = coords .reshape (- 1 , 2 ) # flatten the grid structure; keep x, y
6445+ self ._update_pocolor_lims (collection , coords )
6446+ return collection
64636447
6448+ def _update_pocolor_lims (self , collection , coords ):
6449+ """
6450+ Common code for updating lims in pcolor() and pcolormesh() methods.
6451+ """
64646452 # Transform from native to data coordinates?
64656453 t = collection ._transform
64666454 if (not isinstance (t , mtransforms .Transform ) and
@@ -6479,7 +6467,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
64796467 collection .sticky_edges .y [:] = [miny , maxy ]
64806468 self .update_datalim (coords )
64816469 self ._request_autoscale_view ()
6482- return collection
6470+
64836471
64846472 @_preprocess_data ()
64856473 @_docstring .interpd
0 commit comments