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

87 Ansichten (letzte 30 Tage)
What does this code mean?
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
  7 Kommentare
sipsj11
sipsj11 am 13 Dez. 2017
In the new MATLAB you'll need to set figure size by the code below, the previous syntax no longer works
fig=gcf;
fig.Units='normalized';
fig.OuterPosition=[0 0 1 1];
Steven Lord
Steven Lord am 13 Dez. 2017
That's not correct, sipsj11. The newer [object].[property] syntax will not work in older (pre-R2014b) releases of MATLAB, but the older set-based syntax will work in older and newer releases.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 12 Feb. 2013
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

Weitere Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 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
try
set(gcf, 'units','centimeters','outerposition',[0 0 20 10]);
  6 Kommentare
Milena Parada
Milena Parada am 8 Okt. 2016
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
Walter Roberson am 8 Okt. 2016
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Graphics Objects finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by