How to get 3 plots on the same graph using the same axes?
How to get 3 plots on the same graph using the same axes?
(OP)
Hello there,
I am a beginner on MATLAB. Facing problem to get 3 plots using the same axes. Hope my note is understandable .....
Here's the scenerio.
I have 3 column vectors of same certain length - A, B, C. C contains 3 discrete values - aa, bb, cc. At any one time, aa, bb, cc can have the same A & B.
I want to compare the 3 different values of C by different colours on the same graph with A & B as the x-y axes.
Using plot(A, B, 'r*') can give me what I required but w/o the 3 different colours of C.
Can someone help me on this?
Many thanks in advance!
I am a beginner on MATLAB. Facing problem to get 3 plots using the same axes. Hope my note is understandable .....
Here's the scenerio.
I have 3 column vectors of same certain length - A, B, C. C contains 3 discrete values - aa, bb, cc. At any one time, aa, bb, cc can have the same A & B.
I want to compare the 3 different values of C by different colours on the same graph with A & B as the x-y axes.
Using plot(A, B, 'r*') can give me what I required but w/o the 3 different colours of C.
Can someone help me on this?
Many thanks in advance!





RE: How to get 3 plots on the same graph using the same axes?
hold on % allows adding overplots
plot(A,B,bb,'b*') % plot will be blue
plot(A,B,cc,'c*') % plot will be cyan
RE: How to get 3 plots on the same graph using the same axes?
I put in the aa value but the command won't work.
??? Error using ==> plot
String argument is an unknown option.
Error in ==> D:\csv1.m
On line 21 ==> plot(c, s, 0, 'r*');
RE: How to get 3 plots on the same graph using the same axes?
What I need to know, to be of further help, is how are aa, bb, and cc contained in C? Are they as an array or as a struct?
Figure out how to access those values, and then replace that addressing with the aa, bb, and cc in the previous example. Then you should get your plot.
RE: How to get 3 plots on the same graph using the same axes?
Thanks so much for your help.
aa, bb, cc is stored as array.
Took me quite a while and I managed to access aa, bb, cc. I sort them out and plot them by calling aa to plot with A & B, calling bb to plot with A & B and so on... with hold on. This way, I get the aa, bb, cc to plot on the same A & B axes.