Azzera filtri
Azzera filtri

GUI Plotting "hold on" problem

4 visualizzazioni (ultimi 30 giorni)
John
John il 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?

Risposta accettata

Fangjun Jiang
Fangjun Jiang il 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 Commenti
Fangjun Jiang
Fangjun Jiang il 9 Nov 2011
Use hold(axes_handle,'on')
John
John il 9 Nov 2011
yep I did this right before you recommended it to me haha. Thank you though.

Accedi per commentare.

Più risposte (1)

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

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by