Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ac36171

Browse files
committed
Generate reversed ListedColormaps
1 parent 655e109 commit ac36171

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/matplotlib/_cm_listed.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,3 +1036,7 @@
10361036
('viridis', _viridis_data)):
10371037

10381038
cmaps[name] = ListedColormap(data, name=name)
1039+
# generate reversed colormap
1040+
name = name + '_r'
1041+
data = [rgb for rgb in reversed(data)]
1042+
cmaps[name] = ListedColormap(data, name=name)

0 commit comments

Comments
 (0)