dock graphics window size

12 views (last 30 days)
Stephen Leung
Stephen Leung on 17 Jul 2018
Commented: Adam Danz on 3 Sep 2024
I use graphics with property editor. I mistakenly resize the window. How do I get back to the default size? When I use 'copy figure' option, the size of the graphics depends on my graphics window size. I find no way to get back to the original default size. Tried exit and restart MATLAB, but it remembers my last window size for the graphics window (with property tool in the bottom)

Answers (2)

Hitesh
Hitesh on 26 Aug 2024
Edited: Hitesh on 26 Aug 2024
Hello Stephen,
There are several methods to reset the window size to its default settings:
  • Property Inspector: Open the Property Inspector for the figure you wish to adjust. Click on "Figure1" (default view) and modify the position under the Position tab using the format[x, y, width, height].
  • Figure Command: Use the following command to set the figure window size:
fig = figure('Position', [100, 25, 600, 600]);
  • Default Position:Use this command to reset the figure's position and the size to default settings:
set(fig, 'DefaultFigurePosition', 'factory');
figure;
Ihope this resolves your query.
  1 Comment
Adam Danz
Adam Danz on 3 Sep 2024
This last example is incomplete.
set(fig, 'DefaultFigurePosition', 'factory');
figure;
This will not affect the figure's position until the position property is set. Here's the complete version:
fig = figure();
set(fig, 'DefaultFigurePosition', 'factory', 'Position','default');
This is setting the figure's default-position to MATLAB's factory default position and then setting the figure's Position to the default which is defined here as factory. This is review here in the doc.
It's much easier just to set the figure's Position to factory as shown in my answer.

Sign in to comment.


Adam Danz
Adam Danz on 3 Sep 2024
Edited: Adam Danz on 3 Sep 2024
To set an existing figure's position back to the factory default,
set(fig,'Position','factory')
Note that set() must be used with the factory flag as opposed to dot notation.
To reset the default figure position for all future figures (see groot),
set(groot, 'DefaultFigurePosition', 'factory')
You may also want to reset figure units.
set(fig,'Units','factory')
set(groot, 'DefaultFigureUnits', 'factory')

Categories

Find more on Graphics Object Programming 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!