File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
doc/api/next_api_changes/deprecations Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change
1
+ ``matplotlib.cm.LUTSIZE ``
2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
3
+ is deprecated. Use :rc: `image.lut ` instead. This value only affects colormap
4
+ quantization levels for default colormaps generated at module import time.
Original file line number Diff line number Diff line change 26
26
from matplotlib ._cm_listed import cmaps as cmaps_listed
27
27
28
28
29
- LUTSIZE = mpl .rcParams ['image.lut' ]
29
+ # module-level deprecations.
30
+ @functools .lru_cache (None )
31
+ def __getattr__ (name ):
32
+ if name == "LUTSIZE" :
33
+ _api .warn_deprecated ("3.5" , name = name ,
34
+ alternative = "rcParams['image.lut']" )
35
+ return _LUTSIZE
36
+
37
+
38
+ _LUTSIZE = mpl .rcParams ['image.lut' ]
30
39
31
40
32
41
def _gen_cmap_registry ():
@@ -37,11 +46,11 @@ def _gen_cmap_registry():
37
46
cmap_d = {** cmaps_listed }
38
47
for name , spec in datad .items ():
39
48
cmap_d [name ] = ( # Precache the cmaps at a fixed lutsize..
40
- colors .LinearSegmentedColormap (name , spec , LUTSIZE )
49
+ colors .LinearSegmentedColormap (name , spec , _LUTSIZE )
41
50
if 'red' in spec else
42
51
colors .ListedColormap (spec ['listed' ], name )
43
52
if 'listed' in spec else
44
- colors .LinearSegmentedColormap .from_list (name , spec , LUTSIZE ))
53
+ colors .LinearSegmentedColormap .from_list (name , spec , _LUTSIZE ))
45
54
# Generate reversed cmaps.
46
55
for cmap in list (cmap_d .values ()):
47
56
rmap = cmap .reversed ()
You can’t perform that action at this time.
0 commit comments