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

Skip to content

ENH: add modified CMRmap colormap with improved linearity #5172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/matplotlib/_cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1889,6 +1889,18 @@ def gfunc32(x):
(0.875, 0.50, 0.50),
(1.000, 1.00, 1.00))}

# Modification of CMRmap to improve linearity of luminance
# by Christopher Hummersone, BSD Licensed
# http://www.mathworks.com/matlabcentral/fileexchange/39552-modified-cmrmap
_CMRmap2_data = ((0.0, 0.0, 0.0),
(0.1, 0.1, 0.35),
(0.3, 0.15, 0.65),
(0.6, 0.2, 0.50),
(1.0, 0.25, 0.15),
(0.9, 0.55, 0.0),
(0.9, 0.75, 0.1),
(0.9, 0.9, 0.5),
(1.0, 1.0, 1.0))

# An MIT licensed, colorblind-friendly heatmap from Wistia:
# https://github.com/wistia/heatmap-palette
Expand Down Expand Up @@ -1927,6 +1939,7 @@ def gfunc32(x):
'bwr': _bwr_data,
'brg': _brg_data,
'CMRmap': _CMRmap_data,
'CMRmap2': _CMRmap2_data,
'cool': _cool_data,
'copper': _copper_data,
'cubehelix': _cubehelix_data,
Expand Down
6 changes: 6 additions & 0 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2106,6 +2106,8 @@ def colormaps():
maintains an aesthetically pleasing color image that
automatically reproduces to a monotonic grayscale with
discrete, quantifiable saturation levels." [#]_
CMRmap2 Modified version of CMRmap that improves its luminosity
linearity for low values. [#]_
cubehelix Unlike most other color schemes cubehelix was designed
by D.A. Green to be monotonically increasing in terms
of perceived brightness. Also, when printed on a black
Expand Down Expand Up @@ -2161,6 +2163,10 @@ def colormaps():
<http://www.mathworks.com/matlabcentral/fileexchange/2662-cmrmap-m>`_
by Carey Rappaport

.. [#] See `Modified CMRmap
<http://www.mathworks.com/matlabcentral/fileexchange/39552-modified-cmrmap>`_
by Christopher Hummersone

.. [#] Changed to distinguish from ColorBrewer's *Spectral* map.
:func:`spectral` still works, but
``set_cmap('nipy_spectral')`` is recommended for clarity.
Expand Down