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

Skip to content

Commit ad7cb00

Browse files
authored
Merge pull request #9532 from anntzer/colormaps-doc
Further improve colormap discussion.
2 parents d2a8e67 + 7996fd3 commit ad7cb00

File tree

2 files changed

+8
-35
lines changed

2 files changed

+8
-35
lines changed

examples/color/colormap_reference.py

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,17 @@
55
66
Reference for colormaps included with Matplotlib.
77
8-
This reference example shows all colormaps included with Matplotlib. Note that
9-
any colormap listed here can be reversed by appending "_r" (e.g., "pink_r").
10-
These colormaps are divided into the following categories:
11-
12-
Sequential:
13-
These colormaps are approximately monochromatic colormaps varying smoothly
14-
between two color tones---usually from low saturation (e.g. white) to high
15-
saturation (e.g. a bright blue). Sequential colormaps are ideal for
16-
representing most scientific data since they show a clear progression from
17-
low-to-high values.
18-
19-
Diverging:
20-
These colormaps have a median value (usually light in color) and vary
21-
smoothly to two different color tones at high and low values. Diverging
22-
colormaps are ideal when your data has a median value that is significant
23-
(e.g. 0, such that positive and negative values are represented by
24-
different colors of the colormap).
25-
26-
Qualitative:
27-
These colormaps vary rapidly in color. Qualitative colormaps are useful
28-
for
29-
choosing a set of discrete colors. For example::
30-
31-
color_list = plt.cm.Set3(np.linspace(0, 1, 12))
32-
33-
gives a list of RGB colors that are good for plotting a series of lines on
34-
a dark background.
35-
36-
Miscellaneous:
37-
Colormaps that don't fit into the categories above.
8+
A reversed version of each of these colormaps is available by appending
9+
``_r`` to the name, e.g., ``viridis_r``.
3810
11+
See :doc:`/tutorials/colors/colormaps` for an in-depth discussion about
12+
colormaps, including colorblind-friendliness.
3913
"""
14+
4015
import numpy as np
4116
import matplotlib.pyplot as plt
4217

4318

44-
# Have colormaps separated into categories:
45-
# http://matplotlib.org/examples/color/colormaps_reference.html
4619
cmaps = [('Perceptually Uniform Sequential', [
4720
'viridis', 'plasma', 'inferno', 'magma']),
4821
('Sequential', [

lib/matplotlib/cm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""
2-
This module provides a large set of colormaps, functions for
3-
registering new colormaps and for getting a colormap by name,
4-
and a mixin class for adding color mapping functionality.
2+
Builtin colormaps, colormap handling utilities, and the `ScalarMappable` mixin.
53
4+
See :doc:`/gallery/color/colormap_reference` for a list of builtin colormaps.
5+
See :doc:`/tutorials/colors/colormaps` for an in-depth discussion of colormaps.
66
"""
77
from __future__ import (absolute_import, division, print_function,
88
unicode_literals)

0 commit comments

Comments
 (0)