Figure position changes after printing

4 ビュー (過去 30 日間)
Tomas
Tomas 2025 年 7 月 21 日
コメント済み: Ronit 2025 年 7 月 25 日
I am using R2025a and I have noticed some strange behavior with the size and position of a figure after printing. I create a figure using the call
f = figure('units','normalized','Position',[0.1 0.2 0.24 0.25])
and after the figure is generated I run the line
get(f,'Position')
The result after the get command is [0.1 0.2438 0.2002 0.2062], and not the intended value [0.1 0.2 0.24 0.25]. This is replicated exacly if I set the units and size in separate calls after using
set(f,'Units','normalized')
set(f,'Position',[0.1 0.2 0.24 0.25])
This behavior started with R2025a. I tested these same commands in R2024b and got a figure with the appropriate values in the Position property, and it was indeed bigger than the figure generated with R2025a when compared side by side. How can I make sure that when I generate a figure I get one with the Position values that I had previously set?
PD: I tried setting the properties WindowStyle to normal, Resize to off, and ToolBar and MenuBar to none, all resulted in the same resizing of the output.
  3 件のコメント
Tomas
Tomas 2025 年 7 月 22 日
I am using Windows 11 Home. Something I noted was that if I run the commands in a script programatically, the command get(f,'Position') will give me the right values, but after the figure prints and I run the get command again in the command window I get the "resized" values. Example in the picture attached below.
Ronit
Ronit 2025 年 7 月 25 日
Hi @Tomas,
After following the reproduction steps you provided, I could not reproduce the issue.
>> f = figure('units','normalized','Position',[0.1 0.2 0.24 0.25]);
>> get(f,'Position')
ans =
0.1000 0.2000 0.2400 0.2500
If you are still facing this, I would suggest you create a Technical Support Case: https://www.mathworks.com/support/contact_us.html

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

製品


リリース

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by