@@ -5721,6 +5721,15 @@ def _interp_grid(X):
57215721 C = cbook .safe_masked_invalid (C )
57225722 return X , Y , C , shading
57235723
5724+ def _pcolor_grid_deprecation_helper (self ):
5725+ if any (axis ._major_tick_kw ["gridOn" ]
5726+ for axis in self ._get_axis_list ()):
5727+ _api .warn_deprecated (
5728+ "3.5" , message = "Auto-removal of grids by pcolor() and "
5729+ "pcolormesh() is deprecated since %(since)s and will be "
5730+ "removed %(removal)s; please call grid(False) first." )
5731+ self .grid (False )
5732+
57245733 @_preprocess_data ()
57255734 @docstring .dedent_interpd
57265735 def pcolor (self , * args , shading = None , alpha = None , norm = None , cmap = None ,
@@ -5936,7 +5945,7 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
59365945 collection .set_cmap (cmap )
59375946 collection .set_norm (norm )
59385947 collection ._scale_norm (norm , vmin , vmax )
5939- self .grid ( False )
5948+ self ._pcolor_grid_deprecation_helper ( )
59405949
59415950 x = X .compressed ()
59425951 y = Y .compressed ()
@@ -6173,8 +6182,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
61736182 collection .set_cmap (cmap )
61746183 collection .set_norm (norm )
61756184 collection ._scale_norm (norm , vmin , vmax )
6176-
6177- self .grid (False )
6185+ self ._pcolor_grid_deprecation_helper ()
61786186
61796187 # Transform from native to data coordinates?
61806188 t = collection ._transform
0 commit comments