필터 지우기
필터 지우기

How to specify a legend using pre-determinate matrix

조회 수: 2 (최근 30일)
Alaa Hameed
Alaa Hameed 2017년 1월 23일
댓글: Star Strider 2017년 1월 24일
Hi; I want to specify a legend making use of a predefined matrix. for example, I construct matrix TP based on some selections, then plots have been constructed. After I want to use TP to specify my legend. I tried do it like the following:
for i=1:e
LG(1,i)=num2str(TP{i})
end
legend LG
  댓글 수: 1
Alaa Hameed
Alaa Hameed 2017년 1월 23일
I want to plot within a lope, each lope has its specifications. Then at the end I want to set a legend to define these specifications.

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

답변 (2개)

Star Strider
Star Strider 2017년 1월 23일
Try this:
legend(LG)
  댓글 수: 2
Alaa Hameed
Alaa Hameed 2017년 1월 23일
Thanks, that help in displaying the required information, but the colors are not matching?
Star Strider
Star Strider 2017년 1월 24일
Without seeing the rest of your code, I cannot determine the problem.

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


Geoff Hayes
Geoff Hayes 2017년 1월 23일
Alaa - please make sure that your LG is a cell array as per the documentation at legend. For example,
LG = cell(1,n);
for k=1:n
LG {1,k} = ...;
end

카테고리

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