How to Remove an Entry From the Legend on MATLAB

Written by joe friedman
  • Share
  • Tweet
  • Share
  • Email

MATLAB is an incredibly useful mathematics and engineering software tool capable of performing advanced calculations and engineering simulations. One of its most useful purposes is plotting data into 2D and 3D figures. On graphs with multiple lines or bars of data, a legend is useful to define data series. However, you might not want every data series to appear in the legend. MATLAB does not offer a straightforward way to remove an entry in a legend, but it is possible to do so if you follow a few steps.

Skill level:
Moderately Easy

Other People Are Reading

Instructions

  1. 1

    Click on the button that looks like a mouse pointer in the figure toolbar to enable editing of the plot.

  2. 2

    Click on a data series line or bar to select it.

  3. 3

    Go back to MATLAB's command line and type the following:

    hasbehavior(gco, 'legend', false);

  4. 4

    Return to the figure and right-click on the legend. Click "Refresh," and the legend entry for the line or bar selected in Step 2 will disappear from the legend.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.