3
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?

Jack
  • 105
  • 1
  • 10
  • Please see the relevant documentation [*here*](https://www.mathworks.com/help/matlab/creating_plots/default-property-values.html) – Sardar Usama Nov 07 '18 at 22:59
  • Have already seen relevant documentation. Could you give an example using my data? – Jack Nov 07 '18 at 23:09

1 Answers1

3

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 .

Sardar Usama
  • 19,536
  • 9
  • 36
  • 58