{"id":1162,"date":"2015-02-02T12:00:41","date_gmt":"2015-02-02T17:00:41","guid":{"rendered":"https:\/\/blogs.mathworks.com\/cleve\/?p=1162"},"modified":"2015-01-29T19:03:25","modified_gmt":"2015-01-30T00:03:25","slug":"origins-of-colormaps","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/cleve\/2015\/02\/02\/origins-of-colormaps\/","title":{"rendered":"Origins of Colormaps"},"content":{"rendered":"\r\n<div class=\"content\"><!--introduction--><p>Steve Eddins has recently posted a <a href=\"https:\/\/blogs.mathworks.com\/steve\/category\/colormap\/\">series in his blog<\/a> about colormaps.  I want to add one more post. With release R2014b, we are retiring <tt>jet<\/tt> as the default <tt>colormap<\/tt>, after many years of faithful service.  But did you ever wonder where <tt>jet<\/tt> originated, and how it came to be the default?  And did you ever come across colormaps like <tt>pink<\/tt> and <tt>bone<\/tt>?<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#521a6fc6-37d8-487a-8c0f-ef814b24bcfa\">Color maps<\/a><\/li><li><a href=\"#1b2ebb6e-d715-4a3b-a473-4940ab7ba7b7\">jet<\/a><\/li><li><a href=\"#b7f6e947-73ec-4790-b55f-ea3ade67cb59\">hot<\/a><\/li><li><a href=\"#c6d8c817-85f5-480f-9268-b8a64dc69ad1\">pink<\/a><\/li><li><a href=\"#3c02eb9c-17b7-4cab-9dd2-bb6b827ad4c9\">bone<\/a><\/li><li><a href=\"#cd602c2a-dc45-4965-a501-da5303de3611\">spring<\/a><\/li><li><a href=\"#73b07b38-c629-4837-a186-88b67fadb99d\">parula<\/a><\/li><\/ul><\/div><h4>Color maps<a name=\"521a6fc6-37d8-487a-8c0f-ef814b24bcfa\"><\/a><\/h4><p>MATLAB first began to fully support color and 3D graphics with release 4.0 in 1992.  Graphics hardware at the time had a limited amount of memory and so could only display a limited number of colors in any one figure. All color graphics went through color maps.  Even the colors in full color photographs had to be quantized into a few bits.<\/p><p><tt>Pseudocolor<\/tt> applies to the display of quantities, such as mathematical functions, that do not have any inherent color.  Here the <tt>colormap<\/tt> interprets properties such as height, density or velocity as color. For example, the MathWorks logo, the L-shaped membrane, is the solution to a partial differential equation.  As such, it does not have any color.  A <tt>colormap<\/tt>, together with lighting and shading, makes it visually interesting.<\/p><h4>jet<a name=\"1b2ebb6e-d715-4a3b-a473-4940ab7ba7b7\"><\/a><\/h4><p>The image behind the <tt>jet<\/tt> <tt>colormap<\/tt> comes from astrophysical fluid dynamics calculations made at NCSA, the National Center for Supercomputer Applications at the University of Illinois.  I found the image on the Internet in the very early days of the Internet, possibly even before the availability of the Mosaic web browser, coincidentally also developed at NCSA in 1993.  Astrophysicists Larry Smarr and Mike Norman were among the prominent researchers at NCSA.<\/p><p>The image is available in the MATLAB <tt>demos<\/tt> directory.<\/p><pre class=\"codeinput\">   clear\r\n   load <span class=\"string\">flujet<\/span>\r\n   whos\r\n   snapnow\r\n\r\n   caption\r\n<\/pre><pre class=\"codeoutput\">  Name           Size              Bytes  Class     Attributes\r\n\r\n  X            400x300            960000  double              \r\n  caption        2x32                128  char                \r\n  map           64x3                1536  double              \r\n\r\n<\/pre><pre class=\"codeoutput\">caption =\r\nAstrophysical jet from NCSA.    \r\nOne fluid collides with another.\r\n<\/pre><p>The 400-by-300 array <tt>X<\/tt> contains values of fluid density that have been quantized to \"flints\" (floating point integers) in the range from to 1 to 64.  These serve as indices into the 64-by-3 array <tt>map<\/tt>, which is our <tt>jet<\/tt> <tt>colormap<\/tt>.  The doubles in <tt>map<\/tt> range from 0.0 to 1.0 and specify the brightness of the red, green, and blue components of each pixel.<\/p><pre class=\"codeinput\">   image(X)\r\n   colormap(jet)\r\n   axis <span class=\"string\">image<\/span>\r\n   axis <span class=\"string\">off<\/span>\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_01.png\" alt=\"\"> <p>Even though <tt>jet<\/tt> was originally given as an array of 64-by-3 numbers, it is actually a piecewise linear function of row index with breaks at 1\/8, 3\/8, 5\/8, and 7\/8 of the length.  Jet is a variant of the \"rainbow\" color maps whose faults Steve describes.<\/p><pre class=\"codeinput\">   rgbploter(@jet)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_02.png\" alt=\"\"> <h4>hot<a name=\"b7f6e947-73ec-4790-b55f-ea3ade67cb59\"><\/a><\/h4><p>Here is another simple piecewise linear color map associated with black body radiation.  It accurately describes the color obtained when a chisel made from high-carbon tool steel is heated with an oxy-acetylene torch.  See the web page of <a href=\"http:\/\/www.dondougan.com\/CarvingClassPage-CustomToolmaking.html\">Don Dougan, Sculptor<\/a>. I learned about this map many years ago from Neil Ostlund, a chemistry professor at the University of Waterloo who started <a title=\"http:\/\/www.hyper.com\/AboutUs\/CompanyHistory\/tabid\/385\/Default.aspx (link no longer works)\">Hypercube, Inc.<\/a>, a company that did molecular modeling on the Intel iPSC.<\/p><pre class=\"codeinput\">   clf\r\n   image(X)\r\n   colormap(hot(64))\r\n   axis <span class=\"string\">image<\/span>\r\n   axis <span class=\"string\">off<\/span>\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_03.png\" alt=\"\"> <pre class=\"codeinput\">   rgbploter(@hot)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_04.png\" alt=\"\"> <h4>pink<a name=\"c6d8c817-85f5-480f-9268-b8a64dc69ad1\"><\/a><\/h4><p>Shortly after we introduced colormaps, I was sitting at a terminal demonstrating them to someone and I realized that the maps were just matrices.  I could do array operations on them.  I typed something like this.<\/p><pre class=\"codeinput\">   p = sqrt((2*gray(64) + hot(64))\/3);\r\n<\/pre><p>Taking the square root of a color map!  Wow, that's pretty strange. But the result was useful.  A better name than \"pink\" would be \"sepia\". Here's an old photo I've used many times, tinted to make it look old.<\/p><pre class=\"codeinput\">   clf\r\n   load <span class=\"string\">gatlin<\/span>\r\n   image(X)\r\n   colormap(pink(64))\r\n   axis <span class=\"string\">image<\/span>\r\n   axis <span class=\"string\">off<\/span>\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_05.png\" alt=\"\"> <pre class=\"codeinput\">   rgbploter(@pink)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_06.png\" alt=\"\"> <h4>bone<a name=\"3c02eb9c-17b7-4cab-9dd2-bb6b827ad4c9\"><\/a><\/h4><p>This spine X-ray was high resolution back in the day.  To get a <tt>colormap<\/tt> that looks like old X-ray file, interchange the blue and red columns of <tt>hot<\/tt> and then moderate it with <tt>gray<\/tt>.<\/p><pre class=\"codeinput\">   b = (7*gray(64) + fliplr(hot(64)))\/8;\r\n\r\n   clf\r\n   load <span class=\"string\">spine<\/span>\r\n   image(X)\r\n   colormap(bone(64))\r\n   axis <span class=\"string\">image<\/span>\r\n   axis <span class=\"string\">off<\/span>\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_07.png\" alt=\"\"> <pre class=\"codeinput\">   rgbploter(@bone)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_08.png\" alt=\"\"> <h4>spring<a name=\"cd602c2a-dc45-4965-a501-da5303de3611\"><\/a><\/h4><p>We have colormaps named for all four of the seasons.  They're all simple linear functions of the row index, like this <tt>spring<\/tt>.<\/p><p>The <tt>peaks<\/tt> function has proved to be remarkably popular for testing and demonstrating our 3D graphics.  It's a modification of something I first saw back in my hypercube days from folks whose names I don't remember at Tektronix in Beaverton, Oregon.  They were thinking of nearby Mount St. Helens.<\/p><pre class=\"codeinput\">   clf\r\n   peaks\r\n   colormap(spring(64))\r\n<\/pre><pre class=\"codeoutput\"> \r\nz =  3*(1-x).^2.*exp(-(x.^2) - (y+1).^2) ... \r\n   - 10*(x\/5 - x.^3 - y.^5).*exp(-x.^2-y.^2) ... \r\n   - 1\/3*exp(-(x+1).^2 - y.^2) \r\n \r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_09.png\" alt=\"\"> <pre class=\"codeinput\">   rgbploter(@spring)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_10.png\" alt=\"\"> <h4>parula<a name=\"73b07b38-c629-4837-a186-88b67fadb99d\"><\/a><\/h4><p>Let's see how the old astrophysical jet looks with the new default <tt>colormap<\/tt>.  For discussion of <tt>parula<\/tt>, including many reader's comments, see <a href=\"https:\/\/blogs.mathworks.com\/steve\/category\/colormap\/\">Steve's blog<\/a>.<\/p><pre class=\"codeinput\">   clf <span class=\"string\">reset<\/span>\r\n   load <span class=\"string\">flujet<\/span>\r\n   image(X)\r\n   axis <span class=\"string\">image<\/span>\r\n   axis <span class=\"string\">off<\/span>\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_11.png\" alt=\"\"> <pre class=\"codeinput\">   rgbploter(@parula)\r\n<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_12.png\" alt=\"\"> <p>By the way, if you want to see a list of all the <tt>colormaps<\/tt>, type<\/p><pre class=\"language-matlab\">help <span class=\"string\">graph3d<\/span>\r\n<\/pre><script language=\"JavaScript\"> <!-- \r\n    function grabCode_f227bab5161b470e8d2de4eeb6b57284() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='f227bab5161b470e8d2de4eeb6b57284 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' f227bab5161b470e8d2de4eeb6b57284';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2015 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_f227bab5161b470e8d2de4eeb6b57284()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2014b<br><\/p><\/div><!--\r\nf227bab5161b470e8d2de4eeb6b57284 ##### SOURCE BEGIN #####\r\n%% Origins of Colormaps\r\n% Steve Eddins has recently posted a\r\n% <https:\/\/blogs.mathworks.com\/steve\/category\/colormap\/ series in his blog>\r\n% about colormaps.  I want to add one more post.\r\n% With release R2014b, we are retiring |jet| as the default |colormap|,\r\n% after many years of faithful service.  But did you ever wonder where\r\n% |jet| originated, and how it came to be the default?  And did you ever\r\n% come across colormaps like |pink| and |bone|?\r\n\r\n%% Color maps\r\n% MATLAB first began to fully support color and 3D graphics with release 4.0\r\n% in 1992.  Graphics hardware at the time had a limited amount of memory\r\n% and so could only display a limited number of colors in any one figure.\r\n% All color graphics went through color maps.  Even the colors in full \r\n% color photographs had to be quantized into a few bits.\r\n\r\n%%\r\n% |Pseudocolor| applies to the display of quantities, such as mathematical\r\n% functions, that do not have any inherent color.  Here the |colormap|\r\n% interprets properties such as height, density or velocity as color.\r\n% For example, the MathWorks logo, the L-shaped membrane, is the solution\r\n% to a partial differential equation.  As such, it does not have any\r\n% color.  A |colormap|, together with lighting and shading, makes it\r\n% visually interesting.\r\n\r\n%% jet \r\n% The image behind the |jet| |colormap| comes from astrophysical fluid\r\n% dynamics calculations made at NCSA, the National Center for Supercomputer\r\n% Applications at the University of Illinois.  I found the image on the\r\n% Internet in the very early days of the Internet, possibly even before\r\n% the availability of the Mosaic web browser, coincidentally also developed\r\n% at NCSA in 1993.  Astrophysicists Larry Smarr and Mike Norman were among\r\n% the prominent researchers at NCSA.\r\n\r\n%%\r\n% The image is available in the MATLAB |demos| directory.\r\n\r\n   clear\r\n   load flujet\r\n   whos\r\n   snapnow\r\n\r\n   caption\r\n\r\n%%\r\n% The 400-by-300 array |X| contains values of fluid density that have\r\n% been quantized to \"flints\" (floating point integers) in the range from\r\n% to 1 to 64.  These serve as indices into the 64-by-3 array |map|,\r\n% which is our |jet| |colormap|.  The doubles in |map| range from 0.0 to 1.0\r\n% and specify the brightness of the red, green, and blue components of \r\n% each pixel.\r\n\r\n   image(X)\r\n   colormap(jet)\r\n   axis image\r\n   axis off\r\n   \r\n%%\r\n% Even though |jet| was originally given as an array of 64-by-3 numbers,\r\n% it is actually a piecewise linear function of row index with breaks\r\n% at 1\/8, 3\/8, 5\/8, and 7\/8 of the length.  Jet is a variant of the \"rainbow\"\r\n% color maps whose faults Steve describes.  \r\n\r\n   rgbploter(@jet)\r\n \r\n%% hot\r\n% Here is another simple piecewise linear color map associated with\r\n% black body radiation.  It accurately describes the color obtained\r\n% when a chisel made from high-carbon tool steel is heated with an\r\n% oxy-acetylene torch.  See the web page of\r\n% <http:\/\/www.dondougan.com\/CarvingClassPage-CustomToolmaking.html\r\n% Don Dougan, Sculptor>.\r\n% I learned about this map many years ago from Neil Ostlund, a\r\n% chemistry professor at the University of Waterloo who started\r\n% <http:\/\/www.hyper.com\/AboutUs\/CompanyHistory\/tabid\/385\/Default.aspx\r\n% Hypercube, Inc.>, a company that did molecular modeling on the Intel iPSC.\r\n\r\n   clf\r\n   image(X)\r\n   colormap(hot(64))\r\n   axis image\r\n   axis off\r\n\r\n%%\r\n   rgbploter(@hot)\r\n\r\n%% pink\r\n% Shortly after we introduced colormaps, I was sitting at a terminal\r\n% demonstrating them to someone and I realized that the maps were just\r\n% matrices.  I could do array operations on them.  I typed something\r\n% like this.\r\n   \r\n   p = sqrt((2*gray(64) + hot(64))\/3);\r\n\r\n%%\r\n% Taking the square root of a color map!  Wow, that's pretty strange.\r\n% But the result was useful.  A better name than \"pink\" would be \"sepia\".\r\n% Here's an old photo I've used many times, tinted to make it look old.\r\n\r\n   clf\r\n   load gatlin\r\n   image(X)\r\n   colormap(pink(64))\r\n   axis image\r\n   axis off\r\n   \r\n%%\r\n   rgbploter(@pink)\r\n \r\n\r\n%% bone \r\n% This spine X-ray was high resolution back in the day.  To get a |colormap|\r\n% that looks like old X-ray file, interchange the blue and red columns of\r\n% |hot| and then moderate it with |gray|.\r\n\r\n   b = (7*gray(64) + fliplr(hot(64)))\/8;\r\n\r\n   clf\r\n   load spine\r\n   image(X)\r\n   colormap(bone(64))\r\n   axis image\r\n   axis off\r\n   \r\n%%\r\n   rgbploter(@bone)\r\n\r\n%% spring\r\n% We have colormaps named for all four of the seasons.  They're all simple\r\n% linear functions of the row index, like this |spring|.\r\n\r\n%%\r\n% The |peaks| function has proved to be remarkably popular for testing and\r\n% demonstrating our 3D graphics.  It's a modification of something I first\r\n% saw back in my hypercube days from folks whose names I don't remember\r\n% at Tektronix in Beaverton, Oregon.  They were thinking of nearby\r\n% Mount St. Helens.\r\n\r\n   clf\r\n   peaks\r\n   colormap(spring(64))\r\n\r\n%%\r\n   rgbploter(@spring)\r\n\r\n%% parula\r\n% Let's see how the old astrophysical jet looks with the new default\r\n% |colormap|.  For discussion of |parula|, including many reader's comments,\r\n% see <https:\/\/blogs.mathworks.com\/steve\/category\/colormap\/ Steve's blog>.\r\n\r\n   clf reset\r\n   load flujet\r\n   image(X)\r\n   axis image\r\n   axis off \r\n\r\n%%\r\n   rgbploter(@parula)\r\n   \r\n%%\r\n% By the way, if you want to see a list of all the |colormaps|, type\r\n%\r\n%   help graph3d\r\n%\r\n\r\n##### SOURCE END ##### f227bab5161b470e8d2de4eeb6b57284\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/colormaps_blog_01.png\" onError=\"this.style.display ='none';\" \/><\/div><!--introduction--><p>Steve Eddins has recently posted a <a href=\"https:\/\/blogs.mathworks.com\/steve\/category\/colormap\/\">series in his blog<\/a> about colormaps.  I want to add one more post. With release R2014b, we are retiring <tt>jet<\/tt> as the default <tt>colormap<\/tt>, after many years of faithful service.  But did you ever wonder where <tt>jet<\/tt> originated, and how it came to be the default?  And did you ever come across colormaps like <tt>pink<\/tt> and <tt>bone<\/tt>?... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/cleve\/2015\/02\/02\/origins-of-colormaps\/\">read more >><\/a><\/p>","protected":false},"author":78,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[23,4],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/1162"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/comments?post=1162"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/1162\/revisions"}],"predecessor-version":[{"id":1163,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/1162\/revisions\/1163"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media?parent=1162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/categories?post=1162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/tags?post=1162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}