@@ -5670,6 +5670,15 @@ def _interp_grid(X):
56705670 C = cbook .safe_masked_invalid (C )
56715671 return X , Y , C , shading
56725672
5673+ def _pcolor_grid_deprecation_helper (self ):
5674+ if any (axis ._major_tick_kw ["gridOn" ]
5675+ for axis in self ._get_axis_list ()):
5676+ _api .warn_deprecated (
5677+ "3.5" , message = "Auto-removal of grids by pcolor() and "
5678+ "pcolormesh() is deprecated since %(since)s and will be "
5679+ "removed %(removal)s; please call grid(False) first." )
5680+ self .grid (False )
5681+
56735682 @_preprocess_data ()
56745683 @docstring .dedent_interpd
56755684 def pcolor (self , * args , shading = None , alpha = None , norm = None , cmap = None ,
@@ -5885,7 +5894,7 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None,
58855894 collection .set_cmap (cmap )
58865895 collection .set_norm (norm )
58875896 collection ._scale_norm (norm , vmin , vmax )
5888- self .grid ( False )
5897+ self ._pcolor_grid_deprecation_helper ( )
58895898
58905899 x = X .compressed ()
58915900 y = Y .compressed ()
@@ -6122,8 +6131,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
61226131 collection .set_cmap (cmap )
61236132 collection .set_norm (norm )
61246133 collection ._scale_norm (norm , vmin , vmax )
6125-
6126- self .grid (False )
6134+ self ._pcolor_grid_deprecation_helper ()
61276135
61286136 # Transform from native to data coordinates?
61296137 t = collection ._transform
0 commit comments