plot axes on a different figure window

Asked by Vincent I on 11 Jul 2012
Latest activity Answered by Vincent I on 11 Jul 2012

Hi

I have one plot in one figure and 5 plot buttons in other figure. The way the program works is that each time i push a plot button it would create a plot with 5 different axes. I got the program to work however I would have to use axes(handles.Axes1) and that did not work for me since the plot figure was always up and I was unable to select any other figures. The way I fixed that is by using

set(hObject,'CurrentAxes',handles.Axes1);
   hold(handles.Axes1,'on');
   cah = get(hObject,'CurrentAxes');

to get the axes or the handle. But when I try to create the new axes it creates the new axes on the second figure or the button figure.

h_ax = axes('position',[xpos, cpos(2), cpos(3)*.01666, cpos(4)]);

Is there a way to have the axes created on the first figure(plots) instead of the second figure?

Thank you

3 Comments

Walter Roberson on 11 Jul 2012

In the forum search box, please search for

tag:always-parent

and read my remarks there.

Vincent I on 11 Jul 2012

it worked thank you

 f=figure(get(handles.Axes1,'parent'));
 h_ax = axes('Parent',f,'position',[xpos, cpos(2), cpos(3)*.01666, cpos(4)]);
Vincent I on 11 Jul 2012

it did work... however now the figure is always on top of the others and i am unable to make changes or input values on the other windows/figures... is there a way to avoid that?

Vincent I

Tags

Products

No products are associated with this question.

1 Answer

Answer by Vincent I on 11 Jul 2012
Accepted answer

GOT IT

 set(hObject,'CurrentAxes',handles.Axes1);
 hold(handles.Axes1,'on');
 h_ax = axes('parent',hObject,...
 'position',[a b c d );

0 Comments

Vincent I

Contact us