Effacer les filtres
Effacer les filtres

GUI Plotting "hold on" problem

4 vues (au cours des 30 derniers jours)
John
John le 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?

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (1)

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

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by