{"id":447,"date":"2011-03-07T18:49:15","date_gmt":"2011-03-07T18:49:15","guid":{"rendered":"https:\/\/blogs.mathworks.com\/desktop\/2011\/03\/07\/back-to-basics-figure-toolbar\/"},"modified":"2011-03-07T18:49:15","modified_gmt":"2011-03-07T18:49:15","slug":"back-to-basics-figure-toolbar","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/community\/2011\/03\/07\/back-to-basics-figure-toolbar\/","title":{"rendered":"Back To Basics: Figure Toolbar"},"content":{"rendered":"<p>This week I&#8217;d like to visit an ubiquitous and yet overlooked topic: the toolbar in the figure window. If you consider yourself an advanced user, feel free to stick around; maybe you&#8217;ll see something new. <\/p>\n<p>The figure toolbar came up as the topic of a recent conversation with a colleague. He did not realize that the &#8220;Zoom In&#8221; button has different behaviors depending on the plot type. For a regular 2D plot, it zooms in by effectively changing the axes limits, but for a 3D plot, it keeps the limits the same and changes the size of the axes on screen. As the discussion progressed, I realized that in all the years he&#8217;s been using MATLAB, he hadn&#8217;t really given a ton of thought to the tools of the Figure window. He spends the time to get his data imported and set up just right, but usually accepts a plot as-is or decorates it manually using command-line functions. This is fine most of the time, but I find a little mouse-work saves me a ton of time when it comes to data exploration. <\/p>\n<p>Here is the Figure toolbar, stolen straight from <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2010b\/techdoc\/creating_plots\/f9-53405.html\">our documentation<\/a>.<\/p>\n<div align=\"center\"><img decoding=\"async\" src=\"https:\/\/www.mathworks.com\/help\/releases\/R2010b\/techdoc\/creating_plots\/figure_toolbar.gif\"><\/div>\n<p>The most basic functions: Zoom In, Zoom Out, Pan and Rotate 3D allow you to rearrange and navigate the plot to focus on a particular section of data. These are also useful for exploring a data set to see the data in a particular region, such as where two plots intersect or the location of some minimum or maximum. <\/p>\n<p>The next three buttons deal with the actual data values in the plot. Data cursor provides a tooltip showing the values of the data at point you select with the mouse. Data brushing allows you to to modify or highlight a selection of points and data. <a href=\"https:\/\/blogs.mathworks.com\/community\/2008\/05\/12\/brush-up-on-your-data\/\">I described this feature<\/a> back when it was introduced. Data link keeps the plot automatically in-sync with variables in the workspace. I also <a href=\"https:\/\/blogs.mathworks.com\/community\/2008\/04\/14\/a-link-to-the-data\/\">wrote about this<\/a> back in 2008.<\/p>\n<p>Insert Color Bar and Insert Legend are about adding informational elements to the figure window. I usually see these called via the functions <tt>legend<\/tt> and <tt>colorbar<\/tt>. But, it&#8217;s sometimes nice to use them interactively when you just want to turn one on temporarily. <\/p>\n<p>The final set of buttons toggles Plot Tools, which is an interactive plot editor where you can add\/delete whole elements and change properties like color and line type of a particular dataset. It&#8217;s worthy of its own post, so I&#8217;ll talk about that in future if you&#8217;re interested.<\/p>\n<p>All of the previous tools show up in the default figure toolbar, but there are actually a lot more tools you can turn on to edit and explore plots. There is a camera toolbar that gives finer control around rotating and sizing a 3D plot. <\/p>\n<div align=\"center\"><img decoding=\"async\" src=\"https:\/\/www.mathworks.com\/help\/releases\/R2010b\/techdoc\/creating_plots\/camera_toolbar.gif\"><\/div>\n<p>There&#8217;s also a Plot Edit Toolbar that lets you add text and shapes to a figure. I find this quite useful, as it is much easier to position and size annotations with a mouse than by programmaticaly setting their coordinates. <\/p>\n<div align=\"center\"><img decoding=\"async\" src=\"https:\/\/www.mathworks.com\/help\/releases\/R2010b\/techdoc\/creating_plots\/plotedit_toolbar.gif\"><\/div>\n<p>Both the Plot Edit and Camera toolbars are not shown by default. To get them go to the View menu in the figure window and select one or both. <\/p>\n<p>Are there any plot editing commands you wish were on the toolbar? Do you prefer using the command-line tools like <tt>line<\/tt>, <tt>text<\/tt>, <tt>legend<\/tt>, <tt>rotate<\/tt>, etc or do you prefer the interactive tools?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week I&#8217;d like to visit an ubiquitous and yet overlooked topic: the toolbar in the figure window. If you consider yourself an advanced user, feel free to stick around; maybe you&#8217;ll&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/community\/2011\/03\/07\/back-to-basics-figure-toolbar\/\">read more >><\/a><\/p>\n","protected":false},"author":38,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,97],"tags":[87,101,64,98,99,100],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/447"}],"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\/38"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/comments?post=447"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/447\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/media?parent=447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/categories?post=447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/tags?post=447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}