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

Skip to content

Commit 092d80f

Browse files
committed
Merge pull request matplotlib#486 from cgohlke/patch-2
Add coolwarm color map. Revised patch. Originally submitted by Sameer Gro
2 parents 11b6075 + f16efdf commit 092d80f

File tree

1 file changed

+110
-1
lines changed

1 file changed

+110
-1
lines changed

lib/matplotlib/_cm.py

Lines changed: 110 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,115 @@ def gfunc32(x):
16281628
'blue': lambda x: 1 - x,
16291629
}
16301630

1631+
# This bipolar color map was generated from CoolWarmFloat33.csv of
1632+
# "Diverging Color Maps for Scientific Visualization" by Kenneth Moreland.
1633+
# <http://www.cs.unm.edu/~kmorel/documents/ColorMaps/>
1634+
_coolwarm_data = {
1635+
'red': [
1636+
(0.0, 0.2298057, 0.2298057),
1637+
(0.03125, 0.26623388, 0.26623388),
1638+
(0.0625, 0.30386891, 0.30386891),
1639+
(0.09375, 0.342804478, 0.342804478),
1640+
(0.125, 0.38301334, 0.38301334),
1641+
(0.15625, 0.424369608, 0.424369608),
1642+
(0.1875, 0.46666708, 0.46666708),
1643+
(0.21875, 0.509635204, 0.509635204),
1644+
(0.25, 0.552953156, 0.552953156),
1645+
(0.28125, 0.596262162, 0.596262162),
1646+
(0.3125, 0.639176211, 0.639176211),
1647+
(0.34375, 0.681291281, 0.681291281),
1648+
(0.375, 0.722193294, 0.722193294),
1649+
(0.40625, 0.761464949, 0.761464949),
1650+
(0.4375, 0.798691636, 0.798691636),
1651+
(0.46875, 0.833466556, 0.833466556),
1652+
(0.5, 0.865395197, 0.865395197),
1653+
(0.53125, 0.897787179, 0.897787179),
1654+
(0.5625, 0.924127593, 0.924127593),
1655+
(0.59375, 0.944468518, 0.944468518),
1656+
(0.625, 0.958852946, 0.958852946),
1657+
(0.65625, 0.96732803, 0.96732803),
1658+
(0.6875, 0.969954137, 0.969954137),
1659+
(0.71875, 0.966811177, 0.966811177),
1660+
(0.75, 0.958003065, 0.958003065),
1661+
(0.78125, 0.943660866, 0.943660866),
1662+
(0.8125, 0.923944917, 0.923944917),
1663+
(0.84375, 0.89904617, 0.89904617),
1664+
(0.875, 0.869186849, 0.869186849),
1665+
(0.90625, 0.834620542, 0.834620542),
1666+
(0.9375, 0.795631745, 0.795631745),
1667+
(0.96875, 0.752534934, 0.752534934),
1668+
(1.0, 0.705673158, 0.705673158)],
1669+
'green': [
1670+
(0.0, 0.298717966, 0.298717966),
1671+
(0.03125, 0.353094838, 0.353094838),
1672+
(0.0625, 0.406535296, 0.406535296),
1673+
(0.09375, 0.458757618, 0.458757618),
1674+
(0.125, 0.50941904, 0.50941904),
1675+
(0.15625, 0.558148092, 0.558148092),
1676+
(0.1875, 0.604562568, 0.604562568),
1677+
(0.21875, 0.648280772, 0.648280772),
1678+
(0.25, 0.688929332, 0.688929332),
1679+
(0.28125, 0.726149107, 0.726149107),
1680+
(0.3125, 0.759599947, 0.759599947),
1681+
(0.34375, 0.788964712, 0.788964712),
1682+
(0.375, 0.813952739, 0.813952739),
1683+
(0.40625, 0.834302879, 0.834302879),
1684+
(0.4375, 0.849786142, 0.849786142),
1685+
(0.46875, 0.860207984, 0.860207984),
1686+
(0.5, 0.86541021, 0.86541021),
1687+
(0.53125, 0.848937047, 0.848937047),
1688+
(0.5625, 0.827384882, 0.827384882),
1689+
(0.59375, 0.800927443, 0.800927443),
1690+
(0.625, 0.769767752, 0.769767752),
1691+
(0.65625, 0.734132809, 0.734132809),
1692+
(0.6875, 0.694266682, 0.694266682),
1693+
(0.71875, 0.650421156, 0.650421156),
1694+
(0.75, 0.602842431, 0.602842431),
1695+
(0.78125, 0.551750968, 0.551750968),
1696+
(0.8125, 0.49730856, 0.49730856),
1697+
(0.84375, 0.439559467, 0.439559467),
1698+
(0.875, 0.378313092, 0.378313092),
1699+
(0.90625, 0.312874446, 0.312874446),
1700+
(0.9375, 0.24128379, 0.24128379),
1701+
(0.96875, 0.157246067, 0.157246067),
1702+
(1.0, 0.01555616, 0.01555616)],
1703+
'blue': [
1704+
(0.0, 0.753683153, 0.753683153),
1705+
(0.03125, 0.801466763, 0.801466763),
1706+
(0.0625, 0.84495867, 0.84495867),
1707+
(0.09375, 0.883725899, 0.883725899),
1708+
(0.125, 0.917387822, 0.917387822),
1709+
(0.15625, 0.945619588, 0.945619588),
1710+
(0.1875, 0.968154911, 0.968154911),
1711+
(0.21875, 0.98478814, 0.98478814),
1712+
(0.25, 0.995375608, 0.995375608),
1713+
(0.28125, 0.999836203, 0.999836203),
1714+
(0.3125, 0.998151185, 0.998151185),
1715+
(0.34375, 0.990363227, 0.990363227),
1716+
(0.375, 0.976574709, 0.976574709),
1717+
(0.40625, 0.956945269, 0.956945269),
1718+
(0.4375, 0.931688648, 0.931688648),
1719+
(0.46875, 0.901068838, 0.901068838),
1720+
(0.5, 0.865395561, 0.865395561),
1721+
(0.53125, 0.820880546, 0.820880546),
1722+
(0.5625, 0.774508472, 0.774508472),
1723+
(0.59375, 0.726736146, 0.726736146),
1724+
(0.625, 0.678007945, 0.678007945),
1725+
(0.65625, 0.628751763, 0.628751763),
1726+
(0.6875, 0.579375448, 0.579375448),
1727+
(0.71875, 0.530263762, 0.530263762),
1728+
(0.75, 0.481775914, 0.481775914),
1729+
(0.78125, 0.434243684, 0.434243684),
1730+
(0.8125, 0.387970225, 0.387970225),
1731+
(0.84375, 0.343229596, 0.343229596),
1732+
(0.875, 0.300267182, 0.300267182),
1733+
(0.90625, 0.259301199, 0.259301199),
1734+
(0.9375, 0.220525627, 0.220525627),
1735+
(0.96875, 0.184115123, 0.184115123),
1736+
(1.0, 0.150232812, 0.150232812)]
1737+
}
1738+
1739+
16311740
datad = {
16321741
'afmhot': _afmhot_data,
16331742
'autumn': _autumn_data,
@@ -1700,4 +1809,4 @@ def gfunc32(x):
17001809
datad['gist_rainbow']=_gist_rainbow_data
17011810
datad['gist_stern']=_gist_stern_data
17021811
datad['gist_yarg']=_gist_yarg_data
1703-
1812+
datad['coolwarm']=_coolwarm_data

0 commit comments

Comments
 (0)