@@ -854,8 +854,17 @@ def is_gray(self):
854854 return (np .all (self ._lut [:, 0 ] == self ._lut [:, 1 ]) and
855855 np .all (self ._lut [:, 0 ] == self ._lut [:, 2 ]))
856856
857- def _resample (self , lutsize ):
857+ def resampled (self , lutsize ):
858858 """Return a new colormap with *lutsize* entries."""
859+ if hasattr (self , '_resample' ):
860+ _api .warn_external (
861+ "The ability to resample a color map is now public API "
862+ f"However the class { type (self )} still only implements "
863+ "the previous private _resample method. Please update "
864+ "your class."
865+ )
866+ return self ._resample (lutsize )
867+
859868 raise NotImplementedError ()
860869
861870 def reversed (self , name = None ):
@@ -1050,7 +1059,7 @@ def from_list(name, colors, N=256, gamma=1.0):
10501059
10511060 return LinearSegmentedColormap (name , cdict , N , gamma )
10521061
1053- def _resample (self , lutsize ):
1062+ def resampled (self , lutsize ):
10541063 """Return a new colormap with *lutsize* entries."""
10551064 new_cmap = LinearSegmentedColormap (self .name , self ._segmentdata ,
10561065 lutsize )
@@ -1154,7 +1163,7 @@ def _init(self):
11541163 self ._isinit = True
11551164 self ._set_extremes ()
11561165
1157- def _resample (self , lutsize ):
1166+ def resampled (self , lutsize ):
11581167 """Return a new colormap with *lutsize* entries."""
11591168 colors = self (np .linspace (0 , 1 , lutsize ))
11601169 new_cmap = ListedColormap (colors , name = self .name )
0 commit comments