3

I am using the following code in Matlab

figure
mesh(AAA,BBB,ZZZ)
set(gcf,'Position', [560 528 560*2 420*(1/2)])
colorbar
print -depsc2 -painters XXX.eps

However, the following line:

set(gcf,'Position', [560 528 560*2 420*(1/2)])

does not seem to have any influence on the output file. Thus, how can I specify the dimensions of the output file?

Luis Mendo
  • 110,752
  • 13
  • 76
  • 147
Pietair
  • 396
  • 2
  • 8
  • 18

1 Answers1

3

You need to set the 'Paperposition' property of the figure (not 'Position'):

set(gcf,'Paperposition',[left bottom width height]);

The numbers left, bottom etc are in units determined by the 'PaperUnits' property, which can also be modified.

Luis Mendo
  • 110,752
  • 13
  • 76
  • 147
  • To which Matlab version does this apply? I can't seem to find any details. Maybe that is an indication that it applies to all....? – kkuilla Apr 14 '15 at 11:36
  • @kkuilla I think I remember very old Matlab versions that already had that property, but I'm not sure – Luis Mendo Apr 14 '15 at 12:50