MATLAB: Plot legend does not display any lines

legendMATLABplotting

Hi,
I am plotting a simple graph from a matrix, but when I code as below, the legend does not show any lines, but shows legend names only.
plot(kmat,v(:,1))
title('Convergence of Value Functions')
xlabel('k')
ylabel('v(k)')
hold on
plot(kmat,v(:,5))
plot(kmat,v(:,50))
plot(kmat,v(:,1000))
legend('iter=1','iter=5','iter=50','iter=1000')
hold off
"kmat" is N x 1 matrix for x-axis value, and "v" is N x N matrix where i want to plot values on y-axis.
However, as you can see from the plot below, the legend displays its names but doesn't display any corresponding line.
legend_problem.png

Best Answer

Please see THIS solution for colorbar error
Related Question