@@ -1646,39 +1646,232 @@ def colors():
16461646
16471647def colormaps ():
16481648 """
1649- matplotlib provides the following colormaps.
1650-
1651- * autumn
1652- * bone
1653- * cool
1654- * copper
1655- * flag
1656- * gray
1657- * hot
1658- * hsv
1659- * jet
1660- * pink
1661- * prism
1662- * spring
1663- * summer
1664- * winter
1665- * spectral
1649+ Matplotlib provides a number of colormaps, and others can be added using
1650+ :func:`register_cmap`. This function documents the built-in colormaps,
1651+ and will also return a list of all registered colormaps if called.
16661652
16671653 You can set the colormap for an image, pcolor, scatter, etc,
1668- either as a keyword argument::
1654+ using a keyword argument::
16691655
16701656 imshow(X, cmap=cm.hot)
16711657
1672- or post-hoc using the corresponding pylab interface function::
1658+ or using the :func:`set_cmap` function::
1659+
1660+ imshow(X)
1661+ pyplot.set_cmap('hot')
1662+ pyplot.set_cmap('jet')
1663+
1664+ In interactive mode, :func:`set_cmap` will update the colormap post-hoc,
1665+ allowing you to see which one works best for your data.
1666+
1667+ All built-in colormaps can be reversed by appending ``_r``: For instance,
1668+ ``gray_r`` is the reverse of ``gray``.
1669+
1670+ There are several common color schemes used in visualization:
1671+
1672+ Sequential schemes
1673+ for unipolar data that progresses from low to high
1674+ Diverging schemes
1675+ for bipolar data that emphasizes positive or negative deviations from a
1676+ central value
1677+ Cyclic schemes
1678+ meant for plotting values that wrap around at the
1679+ endpoints, such as phase angle, wind direction, or time of day
1680+ Qualitative schemes
1681+ for nominal data that has no inherent ordering, where color is used
1682+ only to distinguish categories
1683+
1684+ The base colormaps are (with the exception of `spectral`) derived from
1685+ those of the same name provided with Matlab:
1686+
1687+ ========= =======================================================
1688+ Colormap Description
1689+ ========= =======================================================
1690+ autumn sequential linearly-increasing shades of red-orange-yellow
1691+ bone sequential increasing black-white color map with
1692+ a tinge of blue, to emulate X-ray film
1693+ cool linearly-decreasing shades of cyan-magenta
1694+ copper sequential increasing shades of black-copper
1695+ flag repetitive red-white-blue-black pattern (not cyclic at
1696+ endpoints)
1697+ gray sequential linearly-increasing black-to-white
1698+ grayscale
1699+ hot sequential black-red-yellow-white, to emulate blackbody
1700+ radiation from an object at increasing temperatures
1701+ hsv cyclic red-yellow-green-cyan-blue-magenta-red, formed
1702+ by changing the hue component in the HSV color space
1703+ jet a spectral map with dark endpoints, blue-cyan-yellow-red;
1704+ based on a fluid-jet simulation by NCSA [#]_
1705+ pink sequential increasing pastel black-pink-white, meant
1706+ for sepia tone colorization of photographs
1707+ prism repetitive red-yellow-green-blue-purple-...-green pattern
1708+ (not cyclic at endpoints)
1709+ spring linearly-increasing shades of magenta-yellow
1710+ summer sequential linearly-increasing shades of green-yellow
1711+ winter linearly-increasing shades of blue-green
1712+ spectral black-purple-blue-green-yellow-red-white spectrum
1713+ ========= =======================================================
1714+
1715+ For the above list only, you can also set the colormap using the
1716+ corresponding pylab shortcut interface function, similar to Matlab::
16731717
16741718 imshow(X)
16751719 hot()
16761720 jet()
16771721
1678- In interactive mode, this will update the colormap allowing you to
1679- see which one works best for your data.
1680- """
1681- pass
1722+ The next set of palettes are from the `Yorick scientific visualisation
1723+ package <http://yorick.sourceforge.net/index.php>`_, an evolution of
1724+ the GIST package, both by David H. Munro:
1725+
1726+ ============ =======================================================
1727+ Colormap Description
1728+ ============ =======================================================
1729+ gist_earth mapmaker's colors from dark blue deep ocean to green
1730+ lowlands to brown highlands to white mountains
1731+ gist_heat sequential increasing black-red-orange-white, to emulate
1732+ blackbody radiation from an iron bar as it grows hotter
1733+ gist_ncar pseudo-spectral black-blue-green-yellow-red-purple-white
1734+ colormap from National Center for Atmospheric
1735+ Research [#]_
1736+ gist_rainbow runs through the colors in spectral order from red to
1737+ violet at full saturation (like *hsv* but not cyclic)
1738+ gist_stern "Stern special" color table from Interactive Data
1739+ Language software
1740+ ============ =======================================================
1741+
1742+ The following colormaps are based on the `ColorBrewer
1743+ <http://colorbrewer.org>`_ color specifications and designs developed by
1744+ Cynthia Brewer:
1745+
1746+ ColorBrewer Diverging (luminance is highest at the midpoint, and
1747+ decreases towards differently-colored endpoints):
1748+
1749+ ======== ===================================
1750+ Colormap Description
1751+ ======== ===================================
1752+ BrBG brown, white, blue-green
1753+ PiYG pink, white, yellow-green
1754+ PRGn purple, white, green
1755+ PuOr orange, white, purple
1756+ RdBu red, white, blue
1757+ RdGy red, white, gray
1758+ RdYlBu red, yellow, blue
1759+ RdYlGn red, yellow, green
1760+ Spectral red, orange, yellow, green, blue
1761+ ======== ===================================
1762+
1763+ ColorBrewer Sequential (luminance decreases monotonically):
1764+
1765+ ======== ====================================
1766+ Colormap Description
1767+ ======== ====================================
1768+ Blues white to dark blue
1769+ BuGn white, light blue, dark green
1770+ BuPu white, light blue, dark purple
1771+ GnBu white, light green, dark blue
1772+ Greens white to dark green
1773+ Greys white to black (not linear)
1774+ Oranges white, orange, dark brown
1775+ OrRd white, orange, dark red
1776+ PuBu white, light purple, dark blue
1777+ PuBuGn white, light purple, dark green
1778+ PuRd white, light purple, dark red
1779+ Purples white to dark purple
1780+ RdPu white, pink, dark purple
1781+ Reds white to dark red
1782+ YlGn light yellow, dark green
1783+ YlGnBu light yellow, light green, dark blue
1784+ YlOrBr light yellow, orange, dark brown
1785+ YlOrRd light yellow, orange, dark red
1786+ ======== ====================================
1787+
1788+ ColorBrewer Qualitative:
1789+
1790+ (For plotting nominal data, :class:`ListedColormap` should be used,
1791+ not :class:`LinearSegmentedColormap`. Different sets of colors are
1792+ recommended for different numbers of categories. These continuous
1793+ versions of the qualitative schemes may be removed or converted in the
1794+ future.)
1795+
1796+ * Accent
1797+ * Dark2
1798+ * Paired
1799+ * Pastel1
1800+ * Pastel2
1801+ * Set1
1802+ * Set2
1803+ * Set3
1804+
1805+ Other miscellaneous schemes:
1806+
1807+ ========= =======================================================
1808+ Colormap Description
1809+ ========= =======================================================
1810+ afmhot sequential black-orange-yellow-white blackbody
1811+ spectrum, commonly used in atomic force microscopy
1812+ brg blue-red-green
1813+ bwr diverging blue-white-red
1814+ coolwarm diverging blue-gray-red, meant to avoid issues with 3D
1815+ shading, color blindness, and ordering of colors [#]_
1816+ CMRmap "Default colormaps on color images often reproduce to
1817+ confusing grayscale images. The proposed colormap
1818+ maintains an aesthetically pleasing color image that
1819+ automatically reproduces to a monotonic grayscale with
1820+ discrete, quantifiable saturation levels." [#]_
1821+ cubehelix Unlike most other color schemes cubehelix was designed
1822+ by D.A. Green to be monotonically increasing in terms
1823+ of perceived brightness. Also, when printed on a black
1824+ and white postscript printer, the scheme results in a
1825+ greyscale with monotonically increasing brightness.
1826+ This color scheme is named cubehelix because the r,g,b
1827+ values produced can be visualised as a squashed helix
1828+ around the diagonal in the r,g,b color cube.
1829+ gnuplot gnuplot's traditional pm3d scheme
1830+ (black-blue-red-yellow)
1831+ gnuplot2 sequential color printable as gray
1832+ (black-blue-violet-yellow-white)
1833+ ocean green-blue-white
1834+ rainbow spectral purple-blue-green-yellow-orange-red colormap
1835+ with diverging luminance
1836+ seismic diverging blue-white-red
1837+ terrain mapmaker's colors, blue-green-yellow-brown-white,
1838+ originally from IGOR Pro
1839+ ========= =======================================================
1840+
1841+ The following colormaps are redundant and may be removed in future
1842+ versions. It's recommended to use *gray* or *gray_r* instead, which
1843+ produce identical output:
1844+
1845+ ========= =======================================================
1846+ Colormap Description
1847+ ========= =======================================================
1848+ gist_gray identical to *gray*
1849+ gist_yarg identical to *gray_r*
1850+ binary identical to *gray_r*
1851+ ========= =======================================================
1852+
1853+ .. rubric:: Footnotes
1854+
1855+ .. [#] Rainbow colormaps, ``jet`` in particular, are considered a poor
1856+ choice for scientific visualization by many researchers: `Rainbow Color
1857+ Map (Still) Considered Harmful
1858+ <http://www.jwave.vt.edu/%7Erkriz/Projects/create_color_table/color_07.pdf>`_
1859+
1860+ .. [#] Resembles "BkBlAqGrYeOrReViWh200" from NCAR Command
1861+ Language. See `Color Table Gallery
1862+ <http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml>`_
1863+
1864+ .. [#] See `Diverging Color Maps for Scientific Visualization
1865+ <http://www.cs.unm.edu/~kmorel/documents/ColorMaps/>`_ by Kenneth
1866+ Moreland.
1867+
1868+ .. [#] See `A Color Map for Effective Black-and-White Rendering of
1869+ Color-Scale Images
1870+ <http://www.mathworks.com/matlabcentral/fileexchange/2662-cmrmap-m>`_
1871+ by Carey Rappaport
1872+
1873+ """
1874+ return sorted (cm .cmap_d .keys ())
16821875
16831876
16841877## Plotting part 1: manually generated functions and wrappers ##
0 commit comments