MATLAB: Colour of legend doesn’t change

colourgraphlegendMATLABplottingsame

This is my plotting code
%%
%The Spectrum
figure(5);
S1 = (a.^2).*0.5;
plot(f,S1,'b');
hold on;
plot(f,S,'r');
legend ('Initial spectrum','JONSWAP Spectrum');
title('The Spectrum')
xlabel('Frequency (Hz)')
ylabel('Wave spectrum in (m^2/s)')
When I run it I got this one :
figure 5.PNG
The colour of the legend is the same. How can I change it?

Best Answer

Your a looks to have multiple columns, so S1 would have multiple columns.
plot(f,S1,'b');
would generate one line object per column.
Related Question