{"id":1420,"date":"2012-08-27T10:46:11","date_gmt":"2012-08-27T15:46:11","guid":{"rendered":"https:\/\/blogs.mathworks.com\/community\/?p=1420"},"modified":"2018-01-08T14:36:15","modified_gmt":"2018-01-08T19:36:15","slug":"learn-about-matlab-plots-using-trendy","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/community\/2012\/08\/27\/learn-about-matlab-plots-using-trendy\/","title":{"rendered":"Learn about MATLAB Plots using Trendy"},"content":{"rendered":"<p>The other day I was looking at questions from our users on MATLAB <a title=\"MATLAB Answers\" href=\"https:\/\/www.mathworks.com\/matlabcentral\/answers\/\">Answers<\/a>, the MATLAB Central and also on MATLAB&#8217;s <a title=\"MATLAB Community on Facebook\" href=\"https:\/\/www.facebook.com\/MATLAB\">Facebook page<\/a>. I saw quite a few posts asking questions about ways to enhance MATLAB plots. When I am trying to learn something new, I always learn better if I can see how others have done it, so I thought it would be fun to would share some plots from <a title=\"MATLAB Trendy\" href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\">Trendy<\/a> that show basic things you can do. Remember that Trendy lets you click on the &#8220;Show\/Hide Code&#8221; button to see the code the author used to create the plot. <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/show-hide-code1.png\" alt=\"\" title=\"show-hide-code\" width=\"418\" height=\"187\" class=\"alignnone size-full wp-image-1466\" \/><\/p>\n<p>Let&#8217;s take a look at some examples of plots&#8230;<\/p>\n<h3>Using Data Markers<\/h3>\n<p>In <a title=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/plots\/633\" href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/plots\/633\">How many MATLAB jobs in South of France<\/a>, <a title=\" Aurelien Queffurust\" href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/owners\/95\">Aurelien<\/a> is showing a simple chart using Trendy defaults. Notice that data points in the chart are represented by an &#8216;o&#8217;.<\/p>\n<p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/plots\/633\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-1424\" title=\"BasicLine\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/BasicLine-300x245.png\" alt=\"\" width=\"300\" height=\"245\" \/><\/a><\/p>\n<p>In this next trend, <a title=\"Rob Nickerson\" href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/owners\/65\">Rob Nickerson<\/a> has created a simple chart with a different look by removing the data point markers from his plot code and making the lines thicker. Also notice that he has added a label on the y-axis using the ylabel command. He has also kept the chart legend from interfering with his chart by relocating it near the y-axis.<\/p>\n<p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/plots\/677\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/trendy-nickerson.png\" alt=\"\" title=\"trendy-nickerson\" width=\"300\" height=\"219\" class=\"alignnone size-full wp-image-1462\" \/><\/a><\/p>\n<h3>Changing Plot Colors<\/h3>\n<p>In <a title=\"Ned Gulley\" href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/owners\/3\">Ned Gulley&#8217;s<\/a> trend <a title=\"Temperatures in Anchorage and Honolulu (Comparison) \" href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/plots\/578\">Temperatures in Anchorage and Honolulu<\/a>, notice that he has a similar plot charting two different pieces of data. But if you look at his code, you can see how he easily changed the colors in his plot command.<\/p>\n<p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/plots\/578\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-medium wp-image-1426\" title=\"ChangingColors\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/ChangingColors-300x223.png\" alt=\"\" width=\"300\" height=\"223\" \/><\/a><\/p>\n<p>If you&#8217;ve been checking out Trendy at all, you&#8217;ve probably seen <a title=\"Hugo Carr\" href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/owners\/378\">Hugo Carr<\/a>&#8216;s <a title=\"Hugo Carr's Hysteriometer\" href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/plots\/711\">Hysteriometer<\/a> which is &#8220;a measure of the total expressed fear and outrage from newspaper tabloids in Britain benchmarked against their more moderate counterparts&#8221;. (See reference in the British paper, the Independent &#8220;<a title=\"The Independent article &quot;Calm down dears&quot;\" href=\"http:\/\/www.independent.co.uk\/news\/people\/diary\/diary-from-armenia-to-newcastle-and-back-again-6612085.html\">Calm down, dears<\/a>&#8220;.) What you might not have noticed in the plot is how Hugo has controlled the colors used in the plots using ColorOrder, which is a pretty handy feature.<\/p>\n<p><a href=\"https:\/\/blogs.mathworks.com\/community\/files\/MyColors.png\"><img decoding=\"async\" loading=\"lazy\" title=\"MyColors\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/MyColors-300x247.png\" alt=\"\" width=\"300\" height=\"247\" \/><\/a><\/p>\n<h3>Putting Multiple Plots in One Graphic<\/h3>\n<p>One last plot I&#8217;d like to share with you is, again, by <a title=\" Aurelien Queffurust\" href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/owners\/95\">Aurelien<\/a>. In <a title=\"MathWorks should have an office in my village\" href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/plots\/894\">MathWorks should have an office in my village<\/a>, he&#8217;s taken the plot we saw in the earlier example. He&#8217;s used the subplot command to combine it with a second plot, creating a single graphic. It is a good visual technique to compare data while conserving whitespace on your page.<\/p>\n<p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/trendy\/plots\/894\"><img decoding=\"async\" loading=\"lazy\" title=\"Subplot\" src=\"https:\/\/blogs.mathworks.com\/community\/files\/Subplot-300x204.png\" alt=\"\" width=\"300\" height=\"204\" \/><\/a><\/p>\n<h3>Share Your Favorite Trends!<\/h3>\n<p>Do you have a favorite Trendy plot that shows of nifty ways of sharing your data? If so, leave a comment to share them with other readers!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The other day I was looking at questions from our users on MATLAB Answers, the MATLAB Central and also on MATLAB&#8217;s Facebook page. I saw quite a few posts asking questions about ways to enhance&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/community\/2012\/08\/27\/learn-about-matlab-plots-using-trendy\/\">read more >><\/a><\/p>\n","protected":false},"author":66,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[51,36],"tags":[214],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/1420"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/users\/66"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/comments?post=1420"}],"version-history":[{"count":40,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/1420\/revisions"}],"predecessor-version":[{"id":5050,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/1420\/revisions\/5050"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/media?parent=1420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/categories?post=1420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/tags?post=1420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}