필터 지우기
필터 지우기

How to add legend in CIE diagram

조회 수: 2 (최근 30일)
Md Tanvir Emrose
Md Tanvir Emrose 2023년 10월 19일
댓글: Chunru 2023년 10월 19일
I have four points that I want to plot on CIE diagram. I am using the following command:
plotChromaticity
hold on
scatter([x_1 x_2 x_3 x_4],[y_1 y_2 y_3 y_4])
hold off
Now I want to add legend for these four points. For example: 'red', 'blue', 'green', and 'yellow'.
How can I do that?

채택된 답변

Chunru
Chunru 2023년 10월 19일
편집: Chunru 2023년 10월 19일
plotChromaticity
hold on
x = rand(1,4);
y=rand(1,4);
name =["red", "blue", "green", "yellow"]
name = 1×4 string array
"red" "blue" "green" "yellow"
for i=1:length(x)
hs(i) = scatter(x(i), y(i), 'DisplayName', name(i));
end
hold off
legend(hs)
  댓글 수: 2
Md Tanvir Emrose
Md Tanvir Emrose 2023년 10월 19일
편집: Md Tanvir Emrose 2023년 10월 19일
Thank you so much. How can I remove data1 from the legend?
Chunru
Chunru 2023년 10월 19일
See the update above. Use handles of graphic objects.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by