plotting as it is x- axis for first column and y axis for two part one y for second column and above that third column y value? (mean one y and then above that other value for clear visualization in plot)

Asked by S on 22 Jul 2013 at 18:31
Latest activity Commented on by S about 10 hours ago
0.395100  0.282257  0.767033
0.397100  0.296553  0.768326
0.399100  0.311245  0.769771
0.401100  0.327707  0.771041
0.403100  0.342074  0.768785
0.405100  0.356335  0.770814
0.407100  0.370333  0.771074
0.409100  0.382000  0.770967
0.411100  0.394110  0.772648
0.412800  0.401306  0.771393
0.415800  0.412105  0.774670
0.418800  0.416421  0.772872
0.421800  0.418117  0.774908
0.424800  0.416051  0.774679

First column represent x axis, second and third column represent y-axis, want to generate plot with x axis as the values are there and y axis for second column and above that plot the y axis for third column? how can it be?

0 Comments

S

Products

No products are associated with this question.

3 Answers

Answer by Azzi Abdelmalek on 22 Jul 2013 at 18:37

If s is your matrix

x=s(:,1);
y1=s(:,2);
y2=s(:,3);
plotyy(x,y1,x,y2)

5 Comments

S on 23 Jul 2013 at 12:58

How can I insert jpg image in question? So that I can explain clearly?

Azzi Abdelmalek on 23 Jul 2013 at 13:57

Put your image in a hosting website, then copy the the link and put it under

<<  >>

Example

 <<http://azzimalikcom.ipage.com/ansf360.jpg>>
S on 23 Jul 2013 at 14:29

This type of plotting of y values I want? How can I?

Azzi Abdelmalek
Answer by Narges M on 23 Jul 2013 at 14:16

do you mean this? your question is not very clear.

figure; hold on;
a = subplot(2,1,1); plot(y1,x);
b = subplot(2,1,2); plot(y2,x);
linkaxes([a b],'x');

1 Comment

S on 23 Jul 2013 at 14:34

In a single window how can i plot this?

Narges M
Answer by Narges M on 23 Jul 2013 at 14:59
Edited by Narges M on 23 Jul 2013 at 15:03

you cannot have two y axis in a single figure. you could have subplots, each with one x axis and one y axis. in each subplot you can plot as many curves as you want. you could do that like this:

    figure; subplot(1,2,1);
    hold on;
    plot(y1,x, 'r');
    plot(y2,x, 'b');
    .
    .
    .
    plot(y1000, x, 'k');
    hold off;
    subplot(2,1,2);
    hold on;
    plot(yy1,x, 'r');
    plot(yy2,x, 'b');
    .
    .
    .
    plot(yy1000, x, 'k');
    hold off;

you could use different colors (specified by 'r' & 'b', etc) for each plot. see and read more in:

help plot

6 Comments

Narges M on 26 Jul 2013 at 8:57

Matlab cannot find your function "parseArgs". You should put it in the same folder as your running script, or add its path in: File -> Set Path... .

S on 29 Jul 2013 at 16:18

I have done but again two errors are coming? How can I overcome? I have taken two .m file, one is parseargs.m and other is sameaxis.m,

??? Undefined function or method 'fieldnames' for input arguments of type 'cell'.
Error in ==> parseargs at 37
fields = fieldnames(X);
Error in ==> samexaxis at 33
Args=parseArgs(varargin,Args,{'abc' 'join' 'ytickanticlash'});
S about 10 hours ago
I have done but again two errors are coming? How can I overcome? I have taken two .m file, one is parseargs.m and other is sameaxis.m,
??? Undefined function or method 'fieldnames' for input arguments of type 'cell'.
Error in ==> parseargs at 37
fields = fieldnames(X);
Error in ==> samexaxis at 33
Args=parseArgs(varargin,Args,{'abc' 'join' 'ytickanticlash'});
Narges M

Contact us