How to delete extra legend on the graph using Figure properties
12 views (last 30 days)
Show older comments
Dear Everyone,
I have a question regarding how to manipulate the graph legends based on the settings from the figure properties. please find the attached files. I would like to know how can I manually delete the extra legend lines for this case.
Thank you, if someone can answer me this question.
Regards, John
2 Comments
Jitesh Dadich
on 6 Jan 2020
Hey,
Did you find any solution ?
suggest me if you have found some, I am also facing same problem.
Walter Roberson
on 6 Jan 2020
What happened when you tried using the method I described of changing the String property?
Note: there are methods that are more reliable, if you do not insist on proceeding by using the Property Inspector.
Answers (1)
Walter Roberson
on 23 Sep 2018
Click on the String property. The legend will expand to a list of raw character vectors without quotes, one per line. Remove appropriate lines that you do not want to appear, understanding that if you delete any in the middle then that line will not be skipped, that the entries will "fall down" in the list to cover earlier lines. Leaving a blank line might or might not work: the next lines might or might not "fall down", and certainly the corresponding line entry will not be omitted from the legend.
It seems semi-reliable to remove entries this way once per legend without using code to change the properties of the legend.
After you have done this once, you will have trouble adding entries back in. The syntax to use for the text box is not at all clear, and if you experiment you will probably wedge the legend to the point where you would need to delete it and recreate it to get legend entries to work properly.
2 Comments
Walter Roberson
on 25 Sep 2018
Look in the Labels section of the inspector: it is the second main grouping. String is the second property there, below the Autoupdate check box. It is the one that currently says "1x8 cell" in your image.
See Also
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!