Borrar filtros
Borrar filtros

How can I select lines in a subplot and delete them?

6 visualizaciones (últimos 30 días)
Sebastian Gatzka
Sebastian Gatzka el 14 de Mzo. de 2012
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

Respuestas (3)

Honglei Chen
Honglei Chen el 14 de Mzo. de 2012
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
Jan el 14 de Mzo. de 2012
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?
  1 comentario
Sebastian Gatzka
Sebastian Gatzka el 14 de Mzo. de 2012
There is always a data plot and two line objects.
I want to detete both of the last ones and keep the data plot.
Each time I call the above command for h2 I get round about 18 elements inside h2... So they can't be the two lines?!

Iniciar sesión para comentar.


Stephen
Stephen el 14 de Mzo. de 2012
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
  1 comentario
Sebastian Gatzka
Sebastian Gatzka el 14 de Mzo. de 2012
The Figure is saved as a FIG-file. If I call any subplot subplot(2,3,2) to it will delete my current subplot.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by