MATLAB Answers


What does this code mean? set(gcf, 'units','n​ormalized'​,'outerpos​ition',[0 0 1 1]);

Asked by Teemu
on 12 Feb 2013
Latest activity Commented on by Walter Roberson
on 8 Oct 2016 at 12:48

What does this code mean?

set(gcf, 'units','normalized','outerposition',[0 0 1 1]);


Jan Simon
on 12 Feb 2013

@Sean and Azzi: Has there been a question at first or is this only a strange layout idea of Teemu?

@Jan, The question is in the title; frankly I like this format well enough. I know exactly what I'm getting into before clicking on anything.

Jan Simon
on 12 Feb 2013

@Sean: Thanks. Perhaps this style is more convenient, when someony is used to read tweeds or rss feeds. I am so happy with the power to format code, in comparison to CSSM, that I do not like the just-title style.



No products are associated with this question.

2 Answers

Answer by Sean de Wolski
on 12 Feb 2013
 Accepted answer

Set ( set ) the current figure ( gcf ) to have 'Units' be 'normalized' and the 'outerposition', i.e. the actual borders of the figure to be at the bottom left corner (0,0) and span the whole screen (1,1).

Of you could just run it :)

And look at the doc:

doc set
doc figure %click on figure properties


Answer by Azzi Abdelmalek
on 12 Feb 2013

set(gcf, 'units','normalized','outerposition',[0 0 1 1]);

% 'units','normalized' : the unit can be

Units: [ inches | centimeters | normalized | points | {pixels} | characters ]

'outerposition',[0 0 1 1]); the position of your figure [x0,y0,width,height] for normalized unit the min is 0 and the max is 1


set(gcf, 'units','centimeters','outerposition',[0 0 20 10]);


on 12 Feb 2013

now I understand the meaning of that and I know how to use it. Thanks for you answers!

How could works outer positions for subplots? How can I fix double x axis scale ? How can I know the position for each subplot?

Walter Roberson
on 8 Oct 2016 at 12:48

MATLAB does not care whether an axes was generated with subplot(): you can still get the axes OuterPosition or Position property.

If you want to know position of each subplot, then set the Units for each of the axes to Pixels, and then the Position properties can be compared easily.

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!