Search code examples
matlabprintingmatlab-figureeps

Set size of Matlab eps figure


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?


Solution

  • 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.