Subplot 'super' legend

조회 수: 46 (최근 30일)
Ziv Kassner
Ziv Kassner 2015년 10월 1일
편집: Adam Danz 2021년 4월 26일
Is there any new function that allows you to create a legend for all subplots?

채택된 답변

Luffy
Luffy 2015년 10월 1일
편집: Luffy 2015년 10월 1일
  댓글 수: 2
Ziv Kassner
Ziv Kassner 2015년 10월 1일
I was wondering whether there's a new way... thanks anyway
Adam Danz
Adam Danz 2021년 4월 26일
Actually, Matlab does support a global legend in recent releases.
Another answer on that same page provides a demonstration.

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

추가 답변 (1개)

Victor Castro di Filippo
Victor Castro di Filippo 2021년 4월 26일
편집: Victor Castro di Filippo 2021년 4월 26일
Hi. I find this post looking for the same. I found this and works fantastic. Almost 6 years and a pandemic later i hope this works for you. https://www.mathworks.com/matlabcentral/answers/387391-multiple-plots-with-same-legend#answer_309608
On this part you can put your list of string and thats it
legend('show')
  댓글 수: 1
Adam Danz
Adam Danz 2021년 4월 26일
편집: Adam Danz 2021년 4월 26일
This only shows object plotted on the current axes. For example, it doesn't work in this example below. However you can add a global legend by following one of the example in the other answer in the link you shared.
figure
subplot(211)
plot(rand(2,5))
subplot(212)
plot(rand(1,5))
legend('show')

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

카테고리

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