How can I specify in my routine that in p=plot(v, M) curves should be colored by pairs?
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Dear all,
I am new in matlab and I want to plot the values from matrix "M" vs values from vector "v" as following:
p=plot(v, M); In this case I obtain a family of curves that have as a mirror y=0.075.
My question is: how can I specify in my routine that the curves should be colored by pairs? e.g. the two curves closer to y=0.075 (in both sides of y=0,075)should be green, the two next closer curves should be red etc...
Any ideas? thanks in advance
Answers (1)
Jan
on 25 Apr 2013
I guess that you have to decide at first, which curves are "closer to y=0.0075" at first - is this correct?
lineH = plot(v, M);
dist = sum(abs(M - 0.075), 2); % or along the 1st dimension?!
[dummy, index] = sort(dist);
lineH = lineH(index); % Sort the line handles according to their distance
set(lineH(1:2), 'Color', [0, 1, 0]);
set(lineH(3:4), 'Color', [1, 0, 0]);
1 Comment
Jsierra
on 26 Apr 2013
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!