Are you certain that those are the only plotting commands? Did you perhaps test plot once with hold on, then call your commands again? Unless you specify handles, the legend command will just label objects in plotting order.
Your code should work fine:
title('Random noise over time');
legend('Normal','Uniform');
But if perhaps you added some extra plotting...
title('Random noise over time');
legend('Normal','Uniform');
2 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/630794-legends-not-matching-colors#comment_1096569
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/630794-legends-not-matching-colors#comment_1096569
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/630794-legends-not-matching-colors#comment_1096579
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/630794-legends-not-matching-colors#comment_1096579
Sign in to comment.