필터 지우기
필터 지우기

How can I enlarge the height of legend box?

조회 수: 28 (최근 30일)
Riyadh Muttaleb
Riyadh Muttaleb 2018년 9월 26일
댓글: Adam Danz 2018년 9월 27일
Hi everyone,
I would like to enlarge the legend box size (height), I tried to use [set(hleg1,'position',[x0 y0 width height])]
and [textobj = findobj(hobj1, 'type', 'text');set(textobj, 'Interpreter', 'latex', 'fontsize', 15);] but didn't work..
any help,
Thanks in advance, Riyadh

답변 (1개)

Adam Danz
Adam Danz 2018년 9월 26일
You need to use the handle to the legend which you create when you call legend(). The height is the 4th value of the Position parameter. Here I set the height to 10.
lh = legend('BlankLegend');
lh.Position(4) = 10;
  댓글 수: 11
Riyadh Muttaleb
Riyadh Muttaleb 2018년 9월 27일
편집: Riyadh Muttaleb 2018년 9월 27일
Is there any method to make the legend text in the center? I think the text centering will solve my problem.
Adam Danz
Adam Danz 2018년 9월 27일
I made up the name legenHandle - you are supposed to substitute that with your variable name that stores the legend handle.
So I think my hunch is correct. 0.05 and 0.1 are both too small to fit your legend text so the code is ignoring your requesting and fitting the legend to the text. 0.2 is too big. So if you keep playing around with it, you'll find the right size.
There are lots and lots of legend properties you can use to control the appearance of your legend. Try changing the number of columns, for example.

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

카테고리

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