How to delete extra legend on the graph using Figure properties
11 次查看(过去 30 天)
显示 更早的评论
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196418/image.png)
Regards, John
2 个评论
Jitesh Dadich
2020-1-6
Hey,
Did you find any solution ?
suggest me if you have found some, I am also facing same problem.
Walter Roberson
2020-1-6
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.
回答(1 个)
Walter Roberson
2018-9-23
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 个评论
Walter Roberson
2018-9-25
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!