Legend - set legend to 2 group of data
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
dpb
le 22 Déc 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 commentaires
Voir également
Catégories
En savoir plus sur Legend dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!