From: ronnie on
Hi, I have 3 sets of data to plot. two of the sets are time and numerical data which go on the x and y axis respectively. The other set of data is degree values (0 to 180 degreees). I want to plot a line on a graph and I want that line to be red if the data is above 45 degrees (the degree data that corresponds to the numerical data). Otherwise i want the line to be green. I only want one line on the graph. Is there any simple way to do this?
From: us on
ronnie <asdfessssy(a)aol.com> wrote in message <321198735.17645.1277743545983.JavaMail.root(a)gallium.mathforum.org>...
> Hi, I have 3 sets of data to plot. two of the sets are time and numerical data which go on the x and y axis respectively. The other set of data is degree values (0 to 180 degreees). I want to plot a line on a graph and I want that line to be red if the data is above 45 degrees (the degree data that corresponds to the numerical data). Otherwise i want the line to be green. I only want one line on the graph. Is there any simple way to do this?

one of the many solutions
- as a skeleton...

x=0:5:180;
y=sind(x);
ix=x>=45;
line(x(ix),y(ix),'marker','s','color',[1,0,0]);
line(x(~ix),y(~ix),'marker','o','color',[0,1,0]);

us
From: sscnekro on
> Hi, I have 3 sets of data to plot. two of the sets are time and numerical data which go on the x and y axis respectively. The other set of data is degree values (0 to 180 degreees).

So do you need in fact a 3D plot, with x - time, y - numerical data, z - degree values? Maybe plot3() could be of help to you? Otherwise, you could use just plot()...

> I want to plot a line on a graph and I want that line to be red if the data is above 45 degrees (the degree data that corresponds to the numerical data). Otherwise i want the line to be green. I only want one line on the graph.

I'm not sure if I can imagine what you mean by this. Normally the line connects at least two points. How do you relate the degree value to your other data? Can you perhaps hang a picture of the grahp you need at http://imageshack.us/ or http://drop.io/
From: sscnekro on
> x=0:5:180;
> y=sind(x);
> ix=x>=45;
> line(x(ix),y(ix),'marker','s','color',[1,0,0]);
> line(x(~ix),y(~ix),'marker','o','color',[0,1,0]);

Pardon, us, I would never dare to post after your post has been displayed on my screen. To your code, I just say: Wow! Please disregard my question above.
From: ronnie on
ok ill show you exactly what I mean,

3 sets of data:

time = seconds, degree data and numerical data

(time, deg and num are stored in a seperate array each)

time, deg, num
1, 45, 10
2, 56, 20
3, 90, 30
4, 23, 40
5, 34, 50
6, 145, 60
7, 22, 70


what I want would be a line that goes from 10 to 70 while time on the x axis goes from 1 to 7 seconds.

that line would be red only when the corresponding degree values were greater than or equal to 45 degrees and green when the corresponding degree value was less than 45 degrees.

The end result would be a line graph that is both red and green.
 |  Next  |  Last
Pages: 1 2
Prev: Callback syntax
Next: convert a number to string