Figure position changes after printing

6 visualizzazioni (ultimi 30 giorni)
Tomas
Tomas il 21 Lug 2025
Commentato: Ronit il 25 Lug 2025
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 Commenti
Tomas
Tomas il 22 Lug 2025
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 il 25 Lug 2025
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

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Graphics Object Programming in Help Center e File Exchange

Prodotti


Release

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by