@@ -90,9 +90,11 @@ def register_cmap(name=None, cmap=None, data=None, lut=None):
90
90
instance. The *name* is optional; if absent, the name will
91
91
be the :attr:`~matplotlib.colors.Colormap.name` attribute of the *cmap*.
92
92
93
- In the second case, the three arguments are passed to
93
+ The second case is deprecated. Here , the three arguments are passed to
94
94
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, create a `.LinearSegmentedColormap` and use the first
97
+ case: ``register_cmap(cmap=LinearSegmentedColormap(name, data, lut))``.
96
98
"""
97
99
cbook ._check_isinstance ((str , None ), name = name )
98
100
if name is None :
@@ -103,6 +105,13 @@ def register_cmap(name=None, cmap=None, data=None, lut=None):
103
105
if isinstance (cmap , colors .Colormap ):
104
106
cmap_d [name ] = cmap
105
107
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=LinearSegmentedColormap(name, data, lut))" )
106
115
# For the remainder, let exceptions propagate.
107
116
if lut is None :
108
117
lut = mpl .rcParams ['image.lut' ]
0 commit comments