hi everyone, i'm using GUI and i need to plot some sets of data into the same "axes". I can choose, between these sets of data, w[h]ich one i want to plot.
So, i want to set w[h]ich y-axis (the one on the left or the one on the right) specified data has to use, and i want to use its own scale, for each of them.
How can i "say" to specified data to use (for example) the y-axis on the right? (how can i add this "new" axis to the graph?), and how can i use its own scale?
example:
uiTable = get(handles.uitable,'Data');
x = uiTable(:,1);
y = uiTable(:,19); %this one has to be plotted to the left y-axis with its own scale
...
...
uiTable = get(handles.uitable,'Data');
x = uiTable(:,1);
y2 = uiTable(:,12); %this one has to be plotted to the right y-axis with its own scale

 Réponse acceptée

dpb
dpb le 1 Oct 2015

0 votes

After you've got the data, then
hAx=plotyy(x,y,x,y2); % doc plotyy for details...

4 commentaires

Daniele Morello
Daniele Morello le 1 Oct 2015
Modifié(e) : Daniele Morello le 1 Oct 2015
i would to plot them separately too. that's why i ask you if is possible to plot only one set of data on the right y-axis
dpb
dpb le 1 Oct 2015
Modifié(e) : dpb le 2 Oct 2015
Sure, use NaN for placeholders in the alternate axes from the one you're plotting into on initial creation; after the axes are created, use the save handles to plot into the desired target or use line or update the [x|y]data properties directly instead.
Or, you can build the axes initially before the data are collected using NaN for both datasets.
"Spearmint" at the command line with sample data to get the ideas down outside the gui complexity.
Daniele Morello
Daniele Morello le 1 Oct 2015
i really thank u :)
dpb
dpb le 2 Oct 2015
Of course... :) BTW, I commend the section on "Animating Plots" under the "2D Graphics" section for illustrations of how to make updates to plots more efficiently than with the higher level routines when you're updating the same axes with many data changes.
OTOH, if your app is building different plots entirely, it may be as effective to delete the first set of line handles and replot all over again; it'll depend largely on just what it is you're doing.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by