@@ -417,7 +417,7 @@ def _clip_colors(colors, clip=True, gray=0.2):
417417 # warnings.warn(f'{message} "{name}" channel ( > 1).')
418418 return colors
419419
420- def _make_segmentdata_array (values , ratios = None , ** kwargs ):
420+ def _make_segmentdata_array (values , ratios = None ):
421421 """Constructs a list of linear segments for an individual channel.
422422 This was made so that user can input e.g. a callable function for
423423 one channel, but request linear interpolation for another one."""
@@ -628,7 +628,7 @@ def __init__(self, *args, cyclic=False, **kwargs):
628628
629629 def _resample (self , N ):
630630 """Returns a resampled copy of the colormap."""
631- return self .new (self , N = N )
631+ return self .updated (self , N = N )
632632
633633 def concatenate (self , * args , ratios = 1 , name = None , ** kwargs ):
634634 """
@@ -725,9 +725,9 @@ def data(ix, funcs=funcs):
725725 kwargs [ikey ] = gamma
726726
727727 # Return copy
728- return self .new (name = name , segmentdata = segmentdata , ** kwargs )
728+ return self .updated (name = name , segmentdata = segmentdata , ** kwargs )
729729
730- def new (self , name = None , segmentdata = None , N = None ,
730+ def updated (self , name = None , segmentdata = None , N = None ,
731731 gamma = None , cyclic = None ):
732732 """
733733 Returns a new colormap, with relevant properties copied from this one
@@ -736,13 +736,13 @@ def new(self, name=None, segmentdata=None, N=None,
736736 Parameters
737737 ----------
738738 name : str
739- The colormap name. Default is ``self.name + '_new '``.
739+ The colormap name. Default is ``self.name + '_updated '``.
740740 segmentdata, N, gamma, cyclic : optional
741741 See `LinearSegmentedColormap`. If not provided,
742742 these are copied from the current colormap.
743743 """
744744 if name is None :
745- name = self .name + '_new '
745+ name = self .name + '_updated '
746746 if segmentdata is None :
747747 segmentdata = self ._segmentdata
748748 if gamma is None :
@@ -860,7 +860,7 @@ def func_r(x):
860860 gamma = getattr (self , '_' + key , None )
861861 if gamma is not None and np .iterable (gamma ):
862862 kwargs [key ] = gamma [::- 1 ]
863- return self .new (name , segmentdata , ** kwargs )
863+ return self .updated (name , segmentdata , ** kwargs )
864864
865865 def shifted (self , shift = None , name = None , ** kwargs ):
866866 """
@@ -896,7 +896,7 @@ def shifted(self, shift=None, name=None, **kwargs):
896896 array [:,0 ] -= array [:,0 ].min ()
897897 array [:,0 ] /= array [:,0 ].max ()
898898 segmentdata [key ] = array
899- return self .new (name , segmentdata , ** kwargs )
899+ return self .updated (name , segmentdata , ** kwargs )
900900
901901 def sliced (self , left = None , right = None , cut = None , name = None , ** kwargs ):
902902 """
@@ -973,7 +973,7 @@ def sliced(self, left=None, right=None, cut=None, name=None, **kwargs):
973973 if np .iterable (gamma ):
974974 gamma = gamma [l - 1 :r + 1 ]
975975 kwargs [ikey ] = gamma
976- return self .new (name , segmentdata , ** kwargs )
976+ return self .updated (name , segmentdata , ** kwargs )
977977
978978class ListedColormap (mcolors .ListedColormap , _Colormap ):
979979 """New base class for all `~matplotlib.colors.ListedColormap`\ s."""
@@ -1008,22 +1008,22 @@ def concatenate(self, *args, name=None, N=None, **kwargs):
10081008 if name is None :
10091009 name = '_' .join (cmap .name for cmap in cmaps )
10101010 colors = [color for cmap in cmaps for color in cmap .colors ]
1011- return self .new (colors , name , N or len (colors ))
1011+ return self .updated (colors , name , N or len (colors ))
10121012
1013- def new (self , colors = None , name = None , N = None ):
1013+ def updated (self , colors = None , name = None , N = None ):
10141014 """
10151015 Creates copy of the colormap.
10161016
10171017 Parameters
10181018 ----------
10191019 name : str
1020- The colormap name. Default is ``self.name + '_new '``.
1020+ The colormap name. Default is ``self.name + '_updated '``.
10211021 colors, N : optional
10221022 See `~matplotlib.colors.ListedColormap`. If not provided,
10231023 these are copied from the current colormap.
10241024 """
10251025 if name is None :
1026- name = self .name + '_new '
1026+ name = self .name + '_updated '
10271027 if colors is None :
10281028 colors = self .colors
10291029 if N is None :
@@ -1078,7 +1078,7 @@ def shifted(self, shift=None, name=None):
10781078 shift = shift % len (self .colors )
10791079 colors = [* self .colors ] # ensure list
10801080 colors = colors [shift :] + colors [:shift ]
1081- return self .new (colors , name , len (colors ))
1081+ return self .updated (colors , name , len (colors ))
10821082
10831083 def sliced (self , left = None , right = None , name = None ):
10841084 """
@@ -1103,7 +1103,7 @@ def sliced(self, left=None, right=None, name=None):
11031103 if name is None :
11041104 name = self .name + '_sliced'
11051105 colors = self .colors [left :right ]
1106- return self .new (colors , name , len (colors ))
1106+ return self .updated (colors , name , len (colors ))
11071107
11081108class PerceptuallyUniformColormap (LinearSegmentedColormap , _Colormap ):
11091109 """Similar to `~matplotlib.colors.LinearSegmentedColormap`, but instead
@@ -1209,9 +1209,9 @@ def _init(self):
12091209
12101210 def _resample (self , N ):
12111211 """Returns a new colormap with *N* entries."""
1212- return self .new (N = N )
1212+ return self .updated (N = N )
12131213
1214- def new (self , name = None , segmentdata = None , N = None , space = None ,
1214+ def updated (self , name = None , segmentdata = None , N = None , space = None ,
12151215 clip = None , gamma = None , gamma1 = None , gamma2 = None , cyclic = None ):
12161216 """
12171217 Returns a new colormap, with relevant properties copied from this one
@@ -1220,13 +1220,13 @@ def new(self, name=None, segmentdata=None, N=None, space=None,
12201220 Parameters
12211221 ----------
12221222 name : str
1223- The colormap name. Default is ``self.name + '_new '``.
1223+ The colormap name. Default is ``self.name + '_updated '``.
12241224 segmentdata, N, space, clip, gamma, gamma1, gamma2, cyclic : optional
12251225 See `PerceptuallyUniformColormap`. If not provided,
12261226 these are copied from the current colormap.
12271227 """
12281228 if name is None :
1229- name = self .name + '_new '
1229+ name = self .name + '_updated '
12301230 if segmentdata is None :
12311231 segmentdata = self ._segmentdata
12321232 if space is None :
@@ -1330,7 +1330,7 @@ def from_hsl(name,
13301330 ('hue' ,'saturation' ,'luminance' ,'alpha' ),
13311331 (hue ,saturation ,luminance ,alpha )
13321332 ):
1333- cdict [key ] = _make_segmentdata_array (channel , ratios , ** kwargs )
1333+ cdict [key ] = _make_segmentdata_array (channel , ratios )
13341334 return PerceptuallyUniformColormap (name , cdict , ** kwargs )
13351335
13361336 @staticmethod
@@ -1724,7 +1724,7 @@ def Colormap(*args, name=None, listmode='perceptual',
17241724 if len (cmaps ) > 1 : # more than one map?
17251725 cmap = cmaps [0 ].concatenate (* cmaps [1 :], ** kwargs )
17261726 elif kwargs : # modify any props?
1727- cmap = cmaps [0 ].new (** kwargs )
1727+ cmap = cmaps [0 ].updated (** kwargs )
17281728
17291729 # Cut the edges or center
17301730 left = None if np .iterable (left ) else left
0 commit comments