Skip to content

adds two new cyclic color schemes #6254

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

Merged
merged 17 commits into from
May 28, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
renames colormap sunlight to twilight_shifted
  • Loading branch information
bastibe committed May 18, 2018
commit dc166b36be5ccbf2c7aff3afbeb9ba714cef80b7
12 changes: 6 additions & 6 deletions doc/users/next_whats_new/wrapping_colormaps.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Wrapping colormaps
------------------

Two new colormaps named 'twilight' and 'sunlight' were added. These
colormaps start and end on the same color, and have two symmetric
halves with equal lightness, but diverging color. Since they wrap
around, they are a good choice for cyclic data such as phase angles,
compass directions, or time of day. Like viridis, twilight and
sunlight are perceptually uniform and colorblind friendly.
Two new colormaps named 'twilight' and 'twilight_shifted' were added.
These colormaps start and end on the same color, and have two
symmetric halves with equal lightness, but diverging color. Since they
wrap around, they are a good choice for cyclic data such as phase
angles, compass directions, or time of day. Like viridis, twilight is
perceptually uniform and colorblind friendly.
2 changes: 1 addition & 1 deletion examples/color/colormap_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
('Diverging', [
'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu',
'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']),
('Wrapping', ['twilight', 'sunlight', 'hsv']),
('Wrapping', ['twilight', 'twilight_shifted', 'hsv']),
('Qualitative', [
'Pastel1', 'Pastel2', 'Paired', 'Accent',
'Dark2', 'Set1', 'Set2', 'Set3',
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/_cm_listed.py
Original file line number Diff line number Diff line change
Expand Up @@ -1797,8 +1797,8 @@
[0.88554714811952384, 0.84987174283631584, 0.88336206121170946],
[0.88571155122845646, 0.85002186115856315, 0.88572538990087124]]

_sunlight_data = (_twilight_data[len(_twilight_data)//2:] +
_twilight_data[:len(_twilight_data)//2])
_twilight_shifted_data = (_twilight_data[len(_twilight_data)//2:] +
_twilight_data[:len(_twilight_data)//2])

cmaps = {}
for (name, data) in (('magma', _magma_data),
Expand All @@ -1807,7 +1807,7 @@
('viridis', _viridis_data),
('cividis', _cividis_data),
('twilight', _twilight_data),
('sunlight', _sunlight_data)):
('twilight_shifted', _twilight_shifted_data)):

cmaps[name] = ListedColormap(data, name=name)
# generate reversed colormap
Expand Down
16 changes: 8 additions & 8 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1810,14 +1810,14 @@ def colormaps():

A set of cyclic color maps:

========== =========================================================
Colormap Description
========== =========================================================
hsv red-yellow-green-cyan-blue-magenta-red, formed by changing
the hue component in the HSV color space
twilight perceptually uniform shades of white-blue-black-red-white
sunlight perceptually uniform shades of black-red-white-blue-black
========== =========================================================
================ =========================================================
Colormap Description
================ =========================================================
hsv red-yellow-green-cyan-blue-magenta-red, formed by changing
the hue component in the HSV color space
twilight perceptually uniform shades of white-blue-black-red-white
twilight_shifted perceptually uniform shades of black-red-white-blue-black
================ =========================================================


Other miscellaneous schemes:
Expand Down
2 changes: 1 addition & 1 deletion tutorials/colors/colormaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
# for viewers to see perceptually. See an extension on this idea at
# [mycarta-jet]_.

cmaps['Wrapping'] = ['twilight', 'sunlight', 'hsv']
cmaps['Wrapping'] = ['twilight', 'twilight_shifted', 'hsv']

###############################################################################
# Qualitative
Expand Down