Code for publication quality images in Matlab - Adam Oberman Math

Code for publication quality images in Matlab

The default setting in Matlab generates figures which are suitable for viewing, but not for including (especially scaled down by a factor of 2 to 4) in articles. The following code makes the fonts and line thicknesses larger in the figures.


% this file sets the default matlab figure options
% to generate plots which are suitable for including in articles
% line width and font size are made larger
 
%% Set default figure options, even bigger
fprintf('\nSetting default figure options.\n')
set(0,'defaultaxesfontsize',30);
set(0,'defaultaxeslinewidth',1)
set(0,'defaultlinelinewidth',3)
set(0,'defaultpatchlinewidth',1)
 
%% Default printing figure command (won't show the plot)
% note default figure size is 8x6 inches.
% so change the paper size to the same
% and change the figure size as well.
 
figure;
set(gcf, 'PaperUnits', 'inches');
width=8; height = 6;
set(gcf, 'PaperSize', [width height]);
myfiguresize = [0, 0, width, height];
set(gcf, 'PaperPosition', myfiguresize);
 
%%  print the figure
filename = 'Figure1.pdf'
print(gcf, '-dpdf', filename);