Jack
Jack

Reputation: 115

Setting the default figure size of MATLAB

set(gcf,'units','centimeters','position',[0 0 8.86 7.8])

This sets the size for a single figure in my matlab document, how do I do this for all figures plotted in my code?

Upvotes: 3

Views: 6502

Answers (1)

Sardar Usama
Sardar Usama

Reputation: 19689

As explained in the documentation, to change the default figure units and position, set the respective properties like this:

set(0, 'defaultFigureUnits', 'centimeters', 'defaultFigurePosition', [0 0 8.86 7.8]);

or in ≥ R2014b:

set(groot, 'defaultFigureUnits', 'centimeters', 'defaultFigurePosition', [0 0 8.86 7.8]);

If you don't want to change the default properties, you can get the handles of the currently opened figures as explained here and use set to change the relevant properties of all in one go .

Upvotes: 3

Related Questions