Avoid plot title superimposing axis

조회 수: 16 (최근 30일)
Turing Machine
Turing Machine 2021년 11월 19일
댓글: Turing Machine 2021년 11월 20일
When I plot I obtain this:
.
How can I easily avoid the title superimposing the x10^(-3) by placing any of them in a better position? Tried changing the "Position" argument of the function title() (which has the behavior of the function text()) but I don't know how to put it to work properly since I end up putting titles all over the place but not just increasing its height a bit with respect to the plot. I'd really appreciate your help. Thank you!

채택된 답변

Cam Salzberger
Cam Salzberger 2021년 11월 19일
What are you using to position the title so that it comes close to the axes labels there? By default, the title will be center-aligned, so it shouldn't come close. When I use left alignment, the title moves up automatically to get out of the way of the "x10^y":
figure
hAx = axes;
plot(hAx, 10000+rand(10,1))
title(hAx, 'Testing title')
hAx.TitleHorizontalAlignment = 'left';
I guess if it's a really long title, it will get in the way even when center-aligned:
figure
hAx = axes;
plot(hAx, 10000+rand(10,1))
title(hAx, 'Testing really really really really really really really long title')
In that case, you could just make a whitespace sub-title to artificially bump it up. Probably much easier than playing around with position.
figure
hAx = axes;
plot(hAx, 10000+rand(10,1))
title(hAx, 'Testing really really really really really really really long title',' ')
-Cam
  댓글 수: 1
Turing Machine
Turing Machine 2021년 11월 20일
Thanks! The space subtitle worked for me.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by