How to fit legend inside a figure

조회 수: 14 (최근 30일)
shaz
shaz 2012년 10월 27일
i need to plot 250 signals at a time so what the best way to fit all the legends(250) next to plot.
now only few legends are visible(say 50) due to space constraints

채택된 답변

Jan
Jan 2012년 10월 27일
A search in the FEX is a good idea: See FEX: legendgrid, FEX: legendflex, FEX: columnlegend, FEX: gridlegend.
But I doubt, whether a legend with 250 entries can be useful at all. Finding the corresponding line in the diagram will be very time consuming. Perhaps there is visualization which has a much higher usability.
  댓글 수: 1
shaz
shaz 2013년 1월 7일
i have 80 signals & correspondingly 80 legends
as Matt Fig explained how to have multi column legend for this example
plot(rand(250)) L = legend(regexp(sprintf('A%i;',1:80),';','split'));
Thanks in advance

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

추가 답변 (1개)

Matt Fig
Matt Fig 2012년 10월 27일
Even with fontsize 1 the entries are not visible. I think you could make your own legend, but it would require a bit of HG fun and still take up most of the figure. Perhaps you need to rethink your approach...
plot(rand(250))
L = legend(regexp(sprintf('A%i;',1:250),';','split'));
set(L,'fontsize',1)

카테고리

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