Reputation: 173
I have a complicated figure that is composed of 3-4 plots. Those plots are made in outside function; and I use that function in my own script.
The thing is that I want to add one more plot to the existing one. When I try to do that by using "hold on", it adds itself to the wrong place, not into the right plot.
Also, earlier I wanted to change color, thickness and other properties of this second plot - and then I had opened the first function and change those properties there, but for now it doesn't seems to be the proper way to handle this problem. The function can be overwritten when updating MATLAB toolbox. That's why I want to find a solution to handle all of these changes inside my own function.
If you have any ideas, thanks for sharing! Mary
Upvotes: 3
Views: 238
Reputation: 35525
Your solution is likely relating this call:
hAllAxes = findobj(gcf,'type','axes');
This will return all handles to all axes in the current figure. One of the handles, e.g. hAllAxes(1)
is the bottom plot (it will always be the same, but as you haven't shown code I can't tell which one).
Then you can always plot selecting the axes:
plot(hAllAxes(1),myX,myY);
Upvotes: 2