Sunday 10 November 2013

How to save Matlab graphs/plots with high resolution/quality (suitable for publications)?

Use the export-figure file from:

http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig

Examples can be found at:

https://sites.google.com/site/oliverwoodford/software/export_fig


Other settings:

% Colour adjustmentsset(gcf, 'Color', 'w'); %background outside the plot
set(gca, 'Color', 'w'); %background of the plot

% Set figure format - Size
% set(gcf,'Position',[xpos ypos scale*width scale*height])
set(gcf, 'Position', [100 100 150 150])
%or,
scrsz = get(0,'ScreenSize'); %returns the screen size
set(gcf, 'Position', [0 0 0.85*scrsz(3) 1*scrsz(4)]);

% Saving figure using export_fig
figName = [fName(1:end-4) '.png'];

saveas(gcf, figName);
export_fig(figName);

% Example:

function [] = SaveAndExportFigure(figName)
set(gcf, 'Color', 'w'); %background outside the plot
set(gca, 'Color', 'w'); %background of the plot
scrsz = get(0,'ScreenSize');
set(gcf, 'Position', [0 0 0.85*scrsz(3) 1*scrsz(4)]);
saveas(gcf, figName);
export_fig(figName);