{"id":4780,"date":"2013-08-30T09:00:42","date_gmt":"2013-08-30T13:00:42","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=4780"},"modified":"2013-08-29T07:58:45","modified_gmt":"2013-08-29T11:58:45","slug":"colormaps-for-perceptually-challenged-individuals","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2013\/08\/30\/colormaps-for-perceptually-challenged-individuals\/","title":{"rendered":"Colormaps for perceptually challenged individuals"},"content":{"rendered":"<div class=\"content\"><!--introduction--><!--\/introduction--><p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/911\">Brett<\/a>'s Pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/31761-colormaps-compatible-with-red-green-color-perception-deficiencies\">\"Colormaps compatible with red-green color perception deficiencies\"<\/a>, by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/40458\">Matthias Geissbuehler<\/a>.<\/p><p>If you can see a two-digit number in this image, count yourself fortunate:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/600px-Ishihara_9.png\" alt=\"\"> <\/p><p>Most of you will see the \"74\" in this <a href=\"http:\/\/en.wikipedia.org\/wiki\/Ishihara_colourblindness_test\">Ishihara color blindness test image<\/a>. Others will see a \"21.\" And the significant portion of the population with <a href=\"http:\/\/en.wikipedia.org\/wiki\/Achromatopsia\">achromatopsia<\/a>, a form of <a href=\"http:\/\/en.wikipedia.org\/wiki\/Red-green_color_blindness#Red.E2.80.93green_color_blindness\">color blindness<\/a>, will see no numbers at all.<\/p><p>Especially if you <i>can<\/i> see the numbers embedded in the test image, it's easy to forget that many people can't differentiate red from green, and thus can't see them. But we need to keep that in mind when we are creating data visualizations. (I admit that I sometimes forget.)<\/p><p>Matthias's submission addresses this issue nicely, and provides several alternatives for visualizing data with colors designed to facilitate color differentiation by color-deficient individuals.<\/p><pre>testim = label2rgb([ones(100) 2*ones(100);3*ones(100) 4*ones(100)],[1 0 0;0 1 0;0 0 1; 1 1 0]);\r\nimshow(testim)<\/pre><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/fourcolor.png\" alt=\"\"> <\/p><p>(In case you can't see it, the top left block is red, and the top right is green.)<\/p><p>Now let's redisplay the image using colormaps provided by Matthias's file:<\/p><pre>testim2 = rgb2ind(testim,4);\r\ncmap1 = morgenstemning(4);\r\ncmap2 = isolum(4);\r\ncmap3 = ametrine(4);\r\nax(1) = subplot(1,3,1);\r\nsubimage(im,cmap1);title('Morgenstemning')\r\nax(2) = subplot(1,3,2);\r\nsubimage(im,cmap2);title('Isolum')\r\nax(3) = subplot(1,3,3);\r\nsubimage(im,cmap3);title('Ametrine')\r\nset(ax,'xtick',[],'ytick',[])<\/pre><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/rgalteredimg.png\" alt=\"\"> <\/p><p>So, returning to the \"74\" image, we might, for instance, revisualize it using an \"isolum\" colormap:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/seventyfour.png\" alt=\"\"> <\/p><p>I reduced the image to four colors before creating this colormap. There are options that I haven't tried yet that may well improve this visualization, but I'll leave that to your exploration.<\/p><p>(Note: I recognize that some say that color deficiency is a boon under some circumstances. Colorblind individuals may, for instance, be better able to see objects that are camouflaged to the rest of us.)<\/p><p>At Matthias's request, I'm including a citation to his publication on the topic:<\/p><pre>M. Geissbuehler and T. Lasser \"How to display data by color schemes compatible with red-green color perception deficiencies\" Opt. Express 21, 9862-9874 (2013)\r\nhttp:\/\/www.opticsinfobase.org\/oe\/abstract.cfm?URI=oe-21-8-9862<\/pre><p>As always, I welcome your <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=4780#respond\">thoughts and comments<\/a>. Or leave feedback for Matthias <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/31761-colormaps-compatible-with-red-green-color-perception-deficiencies#comments\">here<\/a>.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_9242c14189584e1384e5ba1006841f79() {\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='9242c14189584e1384e5ba1006841f79 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 9242c14189584e1384e5ba1006841f79';\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 2013 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_9242c14189584e1384e5ba1006841f79()\"><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; R2013a<br><\/p><p class=\"footer\"><br>\r\n      Published with MATLAB&reg; R2013a<br><\/p><\/div><!--\r\n9242c14189584e1384e5ba1006841f79 ##### SOURCE BEGIN #####\r\n%% Colormaps for perceptually challenged individuals\r\n%% \r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/911 Brett>'s Pick this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/25964-jann5s-measuretool \"Image Measurement UtilityColormaps compatible with red-green color perception deficiencies\">, by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/40458 Matthias Geissbuehler>.\r\n\r\n%%\r\n% If you can see a two-digit number in this image, count yourself fortunate:\r\n\r\n%%\r\n% \r\n% <<https:\/\/blogs.mathworks.com\/pick\/files\/600px-Ishihara_9.png>>\r\n% \r\n\r\n%%\r\n% Most of you will see the \"74\" in this <http:\/\/en.wikipedia.org\/wiki\/Ishihara_colourblindness_test Ishihara color blindness test image>.\r\n% Others will see a \"21.\" And the significant portion of the population\r\n% with <http:\/\/en.wikipedia.org\/wiki\/Achromatopsia achromatopsia>, a form of \r\n% <http:\/\/en.wikipedia.org\/wiki\/Red-green_color_blindness#Red.E2.80.93green_color_blindness color blindness>, will see\r\n% no numbers at all.\r\n\r\n%%\r\n% Especially if you _can_ see the numbers embedded in the test image, it's\r\n% easy to forget that many people can't differentiate red from green, and\r\n% thus can't see them. But we need to keep that in mind when we are creating\r\n% data visualizations. (I admit that I sometimes forget.)\r\n\r\n%%\r\n% Matthias's submission addresses this issue nicely, and provides several\r\n% alternatives for visualizing data with colors designed to facilitate\r\n% color differentiation by color-deficient individuals.\r\n\r\n%%\r\n%  testim = label2rgb([ones(100) 2*ones(100);3*ones(100) 4*ones(100)],[1 0 0;0 1 0;0 0 1; 1 1 0]);\r\n%  imshow(testim)\r\n\r\n%%\r\n% \r\n% <<https:\/\/blogs.mathworks.com\/pick\/files\/fourcolor.png>>\r\n% \r\n% (In case you can't see it, the top left block is red, and the top right\r\n% is green.)\r\n\r\n%%\r\n% Now let's redisplay the image using colormaps provided by Matthias's file:\r\n\r\n%%\r\n%  testim2 = rgb2ind(testim,4);\r\n%  cmap1 = morgenstemning(4);\r\n%  cmap2 = isolum(4);\r\n%  cmap3 = ametrine(4);\r\n%  ax(1) = subplot(1,3,1);\r\n%  subimage(im,cmap1);title('Morgenstemning')\r\n%  ax(2) = subplot(1,3,2);\r\n%  subimage(im,cmap2);title('Isolum')\r\n%  ax(3) = subplot(1,3,3);\r\n%  subimage(im,cmap3);title('Ametrine')\r\n%  set(ax,'xtick',[],'ytick',[])\r\n\r\n%%\r\n% \r\n% <<https:\/\/blogs.mathworks.com\/pick\/files\/rgalteredimg.png>>\r\n% \r\n\r\n%% \r\n% So, returning to the \"74\" image, we might, for instance, revisualize it\r\n% using an \"isolum\" colormap:\r\n\r\n%%\r\n% \r\n% <<https:\/\/blogs.mathworks.com\/pick\/files\/seventyfour.png>>\r\n% \r\n\r\n%%\r\n% I reduced the image to four colors before creating this colormap. There\r\n% are options that I haven't tried yet that may well improve this\r\n% visualization, but I'll leave that to your exploration.\r\n\r\n%%\r\n% (Note: I recognize that some say that color deficiency is a boon under\r\n% some circumstances. Colorblind individuals may, for instance, be better\r\n% able to see objects that are camouflaged to the rest of us.)\r\n\r\n%% \r\n% At Matthias's request, I'm including a citation to his publication on the topic:\r\n%\r\n%  M. Geissbuehler and T. Lasser \"How to display data by color schemes compatible with red-green\r\n%  color perception deficiencies\" Opt. Express 21, 9862-9874 (2013)\r\n%  http:\/\/www.opticsinfobase.org\/oe\/abstract.cfm?URI=oe-21-8-9862\r\n\r\n%%\r\n% As always, I welcome your\r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=4780#respond thoughts and comments>.\r\n% Or leave feedback for Matthias\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/40458#comments here>.\r\n##### SOURCE END ##### 9242c14189584e1384e5ba1006841f79\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/600px-Ishihara_9.png\" onError=\"this.style.display ='none';\" \/><\/div><p>Brett's Pick this week is \"Colormaps compatible with red-green color perception deficiencies\", by Matthias Geissbuehler.If you can see a two-digit number in this image, count yourself fortunate: Most... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2013\/08\/30\/colormaps-for-perceptually-challenged-individuals\/\">read more >><\/a><\/p>","protected":false},"author":34,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/4780"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/34"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=4780"}],"version-history":[{"count":11,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/4780\/revisions"}],"predecessor-version":[{"id":4795,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/4780\/revisions\/4795"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=4780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=4780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=4780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}