{"id":241,"date":"2010-08-05T08:02:14","date_gmt":"2010-08-05T08:02:14","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/2010\/08\/05\/graphical-display-techniques-part-2\/"},"modified":"2010-08-05T12:02:28","modified_gmt":"2010-08-05T12:02:28","slug":"graphical-display-techniques-part-2","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2010\/08\/05\/graphical-display-techniques-part-2\/","title":{"rendered":"Graphical Display Techniques &#8211; Part 2"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      <p>In a <a href=\"https:\/\/blogs.mathworks.com\/loren\/2010\/07\/22\/graphical-display-techniques-part-1\">recent post<\/a> I discussed how to use different linestyles, colors, and marker properties to ensure that lines are markers that you superimpose\r\n         on a plot will be visible, regardless of what the underlying picture is. Today I will show another technique that works for\r\n         overlaying images or patches on a plot.\r\n      <\/p>\r\n   <\/introduction>\r\n   <h3>Contents<\/h3>\r\n   <div>\r\n      <ul>\r\n         <li><a href=\"#3\">What Techniques Do You Use?<\/a><\/li>\r\n      <\/ul>\r\n   <\/div>\r\n   <p>Let me show how to peek under a patch overlying an image.<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">load <span style=\"color: #A020F0\">clown<\/span>\r\nimage(X),colormap(map)\r\nhold <span style=\"color: #A020F0\">on<\/span>\r\nxx = [150 230 230 150]';\r\nyy = [40 40 110 110]';\r\nhp  = patch(xx,yy,<span style=\"color: #A020F0\">'g'<\/span>);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/241\/graphicsDisp2_01.png\"> <p>As you can see, the green patch I placed on top of the eye makes it impossible to see the covered region of the image.  To\r\n      get a hint at what lies underneath, I can change the transparency of the patch, by changing the transparency of the patch\r\n      face.\r\n   <\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">set(hp,<span style=\"color: #A020F0\">'FaceAlpha'<\/span>,0.2)\r\nhold <span style=\"color: #A020F0\">off<\/span><\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/loren\/241\/graphicsDisp2_02.png\"> <h3>What Techniques Do You Use?<a name=\"3\"><\/a><\/h3>\r\n   <p>Do you have any interesting visualization techniques to share for combining more lines, patches, etc. with other graphical\r\n      components? Please share them <a href=\"https:\/\/blogs.mathworks.com\/loren\/?p=241#respond\">here<\/a>.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_d0b97df214dd4623a3eab9eb85e1bb28() {\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='d0b97df214dd4623a3eab9eb85e1bb28 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' d0b97df214dd4623a3eab9eb85e1bb28';\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        author = 'Loren Shure';\r\n        copyright = 'Copyright 2010 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 author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\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      \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_d0b97df214dd4623a3eab9eb85e1bb28()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; 7.10<br><\/p>\r\n<\/div>\r\n<!--\r\nd0b97df214dd4623a3eab9eb85e1bb28 ##### SOURCE BEGIN #####\r\n%% Graphical Display Techniques - Part 2\r\n% In a \r\n% <https:\/\/blogs.mathworks.com\/loren\/2010\/07\/22\/graphical-display-techniques-part-1 recent post>\r\n% I discussed how to use different linestyles, colors, and marker\r\n% properties to ensure that lines are markers that you superimpose on a\r\n% plot will be visible, regardless of what the underlying picture is.\r\n% Today I will show another technique that works for overlaying images or\r\n% patches on a plot.\r\n%%\r\n% Let me show how to peek under a patch overlying an image.\r\nload clown\r\nimage(X),colormap(map)\r\nhold on\r\nxx = [150 230 230 150]';\r\nyy = [40 40 110 110]';\r\nhp  = patch(xx,yy,'g');\r\n%%\r\n% As you can see, the green patch I placed on top of the eye makes it\r\n% impossible to see the covered region of the image.  To get a hint at what\r\n% lies underneath, I can change the transparency of the patch, by changing\r\n% the transparency of the patch face.\r\nset(hp,'FaceAlpha',0.2)\r\nhold off\r\n%% What Techniques Do You Use?\r\n% Do you have any interesting visualization techniques to share for\r\n% combining more lines, patches, etc. with other graphical components?\r\n% Please share them <https:\/\/blogs.mathworks.com\/loren\/?p=241#respond here>.\r\n##### SOURCE END ##### d0b97df214dd4623a3eab9eb85e1bb28\r\n-->","protected":false},"excerpt":{"rendered":"<p>\r\n   \r\n      In a recent post I discussed how to use different linestyles, colors, and marker properties to ensure that lines are markers that you superimpose\r\n         on a plot will be visible,... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2010\/08\/05\/graphical-display-techniques-part-2\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[21],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/241"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/comments?post=241"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/241\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}