'Legend' Command shows wrong symbols (R2011b)

조회 수: 7 (최근 30일)
Christopher
Christopher 2012년 2월 13일
Hello all,
I have had issues recently when trying to display a legend on a figure. To my knowledge, the command is formatted as:
legend('Re = 2000','Re = 3000','Re = 4000','Re = 5000','Re = 6000',0)
The legend displays properly, but the symbols used for each data set are not displayed correctly. In this instance, the symbols should be 'o','x','+','s', and 'h'. The legend shows up with the symbols 'o','o','x','+', and 'o'.

답변 (1개)

Razvan
Razvan 2012년 2월 13일
The symbols are set in the plot commands, not in the legend command.
Check this example:
M = rand(6, 20);
plot(M(1, :), '-o'); hold all
plot(M(2, :), '-x');
plot(M(3, :), '-+');
plot(M(4, :), '-s');
plot(M(5, :), '-h'); hold off
legend({'Re = 2000','Re = 3000','Re = 4000','Re = 5000','Re = 6000'})
I hope this helps.
Razvan

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by