imshow title is cut off

조회 수: 11 (최근 30일)
Paul
Paul 2024년 10월 10일
댓글: Star Strider 2024년 10월 25일 12:55
I am trying to add a title to an image plotted with imshow. However, if the image is too large, the title gets cut off.
I know that a solution is to play with 'Position' properties of the axes. However, as I want to illustrate sampling issues, I require specific sizes. Since there is a large void space below the image, I would simply like for the image to shift a bit downwards, and stop eating my title.
Below is some sample code, and associated images, ot illustrate the issue.
If anyone has an idea and/or an explanation, I would be glad to them.
Thanks in advance!
figure, imshow(0.7*ones(100)), title('Test1')
figure, imshow(0.7*ones(300)), title('Test2')
figure, imshow(0.7*ones(500)), title('Test3')

채택된 답변

Star Strider
Star Strider 2024년 10월 10일
I cannott reproduce that behaviour, at least here. One possibility is that the problem does not exist in R2024b, and that upgrading could solve it. The other option is to change the figure Position property without altering the axes Position property.
I experimented with that here, although since the problem is not present, I cannot determine if the result is effective.
figure, imshow(0.7*ones(100)), title('Test1')
figure, imshow(0.7*ones(300)), title('Test2')
figure, imshow(0.7*ones(500)), title('Test3')
hf = gcf; % Figure Handle
pos = hf.Position % Get Figure Position
pos = 1×4
1572 1435 696 592
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
hf.Position = pos + [0 -100 0 100]; % Change Figure Position
pos2 = hf.Position % Check Result
pos2 = 1×4
1572 1335 696 692
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
.
  댓글 수: 2
Paul
Paul 2024년 10월 25일 12:36
Thanks, I managed to make this work in the end.
Regarding reproducing the behavior, it turns out it depends on the screen size. No problem when my computer is docked, but problems arise when I'm using my 14' laptop on its own.
Star Strider
Star Strider 2024년 10월 25일 12:55
As always, my pleasure!
I’m happy that you got that sorted. For problems such as yours, there’s not a lot I can do from here except to suggest an approach.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by