GUI Plotting "hold on" problem

4 views (last 30 days)
John
John on 9 Nov 2011
So my GUI contains two axes and multiple checkboxes. If the user checks on a checkbox part of the corresponding data for that checkbox is graphed in one axis while the other half is graphed in the other axis. This works fine. The problem I am having is that when the user selects another checkbox whatever was graphed before is cleared and the new set of data is plotted only. I have tried using the "hold on" feature however for some reason this distorts the x and y scale of my axes (the graphs I am using are loglog and by using "hold on" they get distorted to a regular plot scale) Please help .
p1 = loglog(handles.inplane_graph,freq,ip_yvalues_accep,'g',freq,ip_yvalues_proto,'b');
p2 = loglog(handles.outofplane_graph,freq,oop_yvalues_accep,'g',freq,oop_yvalues_proto,'b');
hold on
So I added the above code in one of my checkboxes, however now when the other checkbox is checked, my 'outofplane_graph' is the only axes that actually holds on to whatever was graphed before it. My 'inplane_graph' axes deletes whatever was graphed before it and graphs the new set of data. I want both of my axes to hold on. Any ideas?

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 9 Nov 2011
Do you mean just "hold on" command will distort the scale, or the new plots added changed the scale? You can always change the scale as you want using axis(), xlim(),ylim() if the scale is changed due to the added new plots.
f=figure(1);
loglog(1:10000);
hold on;
plot(10000:-1:1);
xlim([1 10000]);
  3 Comments
Fangjun Jiang
Fangjun Jiang on 9 Nov 2011
Use hold(axes_handle,'on')
John
John on 9 Nov 2011
yep I did this right before you recommended it to me haha. Thank you though.

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 9 Nov 2011
Try using "hold all" instead of just "hold on".

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!