How can I select lines in a subplot and delete them?
5 次查看(过去 30 天)
显示 更早的评论
Hello World,
I'm currently struggeling with my figures.
I have a figure saved as FIG-file. After I opened it I want to select a specific subplot in it and delete a specific line object in the subplot.
What I know so far is that I can find all subplots/axes (?):
>> h1 = findobj(gcf,'Type','axes')
and that I can find all line objects in the subplot/axis:
>> h2 = findobj(gca,'Type','line')
But how do I link these two informations? Which one of the output of the first command (h1) is the subplot I want to choose? And which one of the output of the second command (h2) ist the line I want to choose?
As the size of h1 and h2 differs from the number of subplots / number of line objects I can see I'm confused with the output.
Any idea? Sebastian
0 个评论
回答(3 个)
Honglei Chen
2012-3-14
If you don't need to automate the process, it's actually easier to do from the figure window. Just click the arrow on the toolbar, and then choose any line from any subplot.
Jan
2012-3-14
We cannot know which of the handles in h1 is the wanted subplot. It is your turn to define this detail.
So start from scratch: How do you define, which line you want to delete?
Stephen
2012-3-14
when you use gca for h2 it will only look in the last axes that was called. you can try recalling the subplot you want, then doing the gca. i.e. subplot(2,3,2) for the 2nd axes in the figure. Then your line should be in h2. Depending on how you plotted the data, it will be in that order in h2 for you to call it and delete it. good luck
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!