MATLAB Answers

0

Why will the legend command not display descripitions properly when using a non-solid line style in R2014B?

KtotheC 님이 질문을 제출함. 3 Feb 2015
최근 활동 KtotheC 님이 댓글을 추가함. 3 Feb 2015
I'm using the legend command in R2014B, and am having issues with it displaying text when a line style other than solid is being used. The code runs successfully in R2012B and works as intended. Try running the example below, thoughts?
figure; hold on; plot([1:10], 1*[1:10], 'b', 'LineWidth', 1); plot([1:10], 2*[1:10], 'r', 'LineWidth', 1); plot([1:10], 3*[1:10], 'g', 'LineWidth', 1, 'LineStyle', '--'); plot([1:10], 4*[1:10], 'm', 'LineWidth', 1, 'LineStyle', '--'); title('Legend Example'); legend({'One','Two','Three','Four'}, 'Location', 'Northwest');
If the "'LineStyle', '--'" options are removed from the above code, the legend appears fine, and the 'Four' label appears.

  댓글 수: 0

로그인 to comment.

태그

답변 수: 1

Youssef Khmou 님의 답변 3 Feb 2015

Remove the curly brackets and try again as :
h=legend('One','Two','Three','Four', 'Location', 'Northwest');

  댓글 수: 1

That had the same outcome; no 'Four' label on the 4th plot.

로그인 to comment.



Translated by