Keeping plot titles in desired location
조회 수: 15 (최근 30일)
이전 댓글 표시
Hi, I am trying to keep the title of the plot towards the right side of the the figure rather than on the top. I wrote a code for doing this, but unfortunately i am not to get the desired result. Can it be done with a function other than 'title'? I tried with 'legend' and 'text', it didn't help me much. Any help to solve this will be appreciated.
![image.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/219700/image.png)
for ii = 2:10:size(a,1)
str0 = sprintf('gdmatrix = %f', rowsum_for_ants_in_gdnest_matrix(ii));
str1 = sprintf('bnmatrix = %f', rowsum_for_ants_in_gdnest_matrix(ii));
str2 = sprintf('field = %f', rowsum_for_ants_in_gdnest_matrix(ii));
str3 = sprintf('home= %f', rowsum_for_ants_in_gdnest_matrix(ii));
title_obj = title({str3;str2;str1;str0});
end
댓글 수: 0
채택된 답변
Fangjun Jiang
2019년 5월 15일
title_obj.Position;
title_obj.Position=[You Value Specified Here]
댓글 수: 5
Evelyn Cooper
2020년 4월 29일
I'm still having troubles figuring out what 'Position' is supposed to be. I tried moving my title by using [left bottom width height] but no matter what numbers I change, the title never goes where I expect it. It doesn't seem to be moving when I gradually increase the "bottom" number. How do I know what values to enter in for 'Position'?
Fangjun Jiang
2020년 4월 29일
The value of the position might depend on the axis. Read it first to see if you can figure it out.
tobj=title('abc');
get(tobj,'Position')
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Title에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!