필터 지우기
필터 지우기

global legend in subplot

조회 수: 133 (최근 30일)
Davindra Usov
Davindra Usov 2023년 2월 1일
댓글: Davindra Usov 2023년 3월 22일
Hello,
I am trying to place my global legend at south east location in my subplot but to no avail. My code is as follows
for t = 1:21
subplot(3,7,t)
plot(x,y)
hold on
plot(x1,y1)
legend('old','new','Location','southeastoutside')
end
This places the legends at the south east location outside of each plot, but I want only one global legend for the whole subplot, not multiple individual legends
any suggestions will be much appreciated

채택된 답변

Voss
Voss 2023년 2월 1일
That cane be done using tiledlayout instead of subplot.
x = 1:10;
y = 1:10;
x1 = 1:10;
y1 = 2:11;
tiledlayout(3,7)
for t = 1:21
nexttile
plot(x,y)
hold on
plot(x1,y1)
end
legend('old','new','Location','southeastoutside')
  댓글 수: 1
Davindra Usov
Davindra Usov 2023년 3월 22일
worked perfectly. Thank you.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by