필터 지우기
필터 지우기

Matlab Legend

조회 수: 2 (최근 30일)
John
John 2011년 10월 6일
So in my plot I have numerous different programs being plotted however a certain program is being plotted in blue while all the other programs are being plotted in grey. Currently, my legend is the following:
legend(highlight,name,'Location','EastOutside');
where highlight is a vector containing all the blue lines,name is a cell that contains the label for each of the blue lines.
What I'm trying to do is in addition to showing this, I would like my legend to show one grey line with the label 'Other Programs' even though there are numerous grey lines being plotted.
Now what I was thinking of doing was the following:
legend([highlight otherprograms(1)],name,'Other Programs','Location','EastOutside');
but it has failed.
Can anyone help me accomplish this?
  댓글 수: 2
Fangjun Jiang
Fangjun Jiang 2011년 10월 6일
What do you mean "programs"? Do you mean curves?
How do you use legend(highlight,name) where highlight is a vector containing all the blue lines? Check doc legend for syntax.
John
John 2011년 10월 6일
Sorry I'm plotting the acceleration vs frequency of satellite programs. So yea "programs" are the curves I am plotting

댓글을 달려면 로그인하십시오.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 10월 6일
plot(magic(10),'b');
Name=strcat('L',cellstr(num2str((1:10)')));
hold on;
plot(magic(3),'r');
h=legend([Name;'other red']);
  댓글 수: 1
John
John 2011년 10월 6일
Thanks for the help

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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