@@ -90,9 +90,11 @@ def register_cmap(name=None, cmap=None, data=None, lut=None):
9090 instance. The *name* is optional; if absent, the name will
9191 be the :attr:`~matplotlib.colors.Colormap.name` attribute of the *cmap*.
9292
93- In the second case, the three arguments are passed to
93+ The second case is deprecated. Here , the three arguments are passed to
9494 the :class:`~matplotlib.colors.LinearSegmentedColormap` initializer,
95- and the resulting colormap is registered.
95+ and the resulting colormap is registered. Instead of this implicit
96+ colormap creation, use the first case by calling
97+ ``register_cmap(cmap=LinearSementedColormap(name, data, lut))``.
9698 """
9799 cbook ._check_isinstance ((str , None ), name = name )
98100 if name is None :
@@ -103,6 +105,13 @@ def register_cmap(name=None, cmap=None, data=None, lut=None):
103105 if isinstance (cmap , colors .Colormap ):
104106 cmap_d [name ] = cmap
105107 return
108+ if lut is not None or data is not None :
109+ cbook .warn_deprecated (
110+ "3.3" ,
111+ message = "Passing raw data via parameters data and lut to "
112+ "register_cmap() is deprecated. Instead use: "
113+ "register_cmap("
114+ "cmap=LinearSementedColormap(name, data, lut))" )
106115 # For the remainder, let exceptions propagate.
107116 if lut is None :
108117 lut = mpl .rcParams ['image.lut' ]
0 commit comments