Why does any figure having "units" set to "normalized" pop up at a different location after the screen resolution is changed ?

1 view (last 30 days)
The following steps demonstrate this issue:
1. Execute the following commands in MATLAB
set(0,'defaultfigureunits','normalized');
set(0,'defaultfigureposition',[0.2 0.2 0.7 0.7]);
figure
get(0,'screensize')
The GET command reflects the current resolution for the display.
2. Now change the display setting to something other than before. For this, click on the desktop->properties->settings
3. Use the FIGURE command again in the MATLAB command prompt. The figure pops up at different location even though the units for the root are set to normalized.
4. Verify the SCREENSIZE property using the GET commad as
get(0,'screensize')
You will still see the old resolution display settings.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The reason for this behavior, is that the resolution for the display is reflected in the SCREENSIZE property of the root; and if you change the resolution when MATLAB is already running, this property does not get updated for that particular session of MATLAB. You need to start a new session of MATLAB to see the SCREENSIZE property of the root being updated to the new settings. If you run your code in the new session of MATLAB, you should be able to get the figure at the same relative position.
You can verify this by using the GET command as follows:
get(0,'screensize')
Since the SCREENSIZE property is read-only, you cannot use the SET command to set it to some default value.

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!