I was working on a MATLAB project and found some strange behavior of the legend
function. Here is the code to reproduce the issue:
X=rand(3,100);
a=rand(3,100);
b=rand(3,100);
figure(1); hold on;
plot(0.17663,'m');
plot(1.223,'y');
plot(X,a,'r');
plot(X,b,'g');
legend({'s1','s2','a','b'});
My question is: The legend in the picture shows the same color for plot 3 and plot 4. Instead it should show red and green respectively. Is there something wrong with legend
?