how to adjust distance between icon legend to its label?

조회 수: 10 (최근 30일)
Amra Rajuli
Amra Rajuli 2018년 4월 22일
댓글: Amra Rajuli 2018년 4월 26일
Hi, I want to decrease the distance between legend icon to its label. If somebody knows, please help. Thank you

답변 (1개)

Priyank Sharma
Priyank Sharma 2018년 4월 25일
You can find the children of Legend object. You can search for the ones that have their Type set to text and relocate them. Below is a sample code to show how to do that. It moves them to left by 0.5 units relative to the legend box. Here 'legend' is your Legend object.
ch = get(legend, 'Children');
textCh = ch(strcmp(get(ch, 'Type'), 'text'));
for i = 1:numel(textCh)
set(textCh(i), 'Position', get(textCh(i), 'Position') + [-0.5 0 0])
end
  댓글 수: 1
Amra Rajuli
Amra Rajuli 2018년 4월 26일
Thank you for your answer. I have tried, but it won't change. any idea? or maybe my step is wrong?

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

카테고리

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