Legend - set legend to 2 group of data
1 view (last 30 days)
Show older comments
Hello I have two data (52,60 lines on plot) I want to have a legend like this
LINES 1 - colour blue
LINES 2 - colour red
But all the time I get the same blue colour because my legend count lines not the group of data . How to set it or skip values ?
I tried to do this like this :
ik=[X(M,N-1),X(M,N),X(M,N+1)];
h1=plot(ik,DataX,'-b');
hold on;
h2=plot(ik,DataY,'-r');
legend([h1 h2],{'ROI2','ROI3'}
??? Error using ==> horzcat
CAT arguments dimensions are not consistent.
M,N are single numbers eg. 100 (index)
0 Comments
Answers (1)
dpb
on 22 Dec 2013
Apparently Data[X|Y] have differing number of columns so since plot returns a column vector of line handles then [h1 h2] is trying to place to columns of different lengths side-by-side.
Use
[h1; h2]
or
[h1' h2']
instead.
0 Comments
See Also
Categories
Find more on Legend in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!