Page tree
Skip to end of metadata
Go to start of metadata

Generating high-quality figures for documents (theses, papers, etc.) can be challenging.  In general, you will want to generate a image file from the figure window and then include that image within your document.  Below are some general notes accomplishing this with a Linux-specific example.

Export Fig

The export_fig utility from the Mathworks File Exchange can do most of the heavy lifting with saving high-resolution images from MATLAB figures.  To use the package you will need to download the zip archive and place it in a location where MATLAB can find the .m file.  You can set the path that MATLAB uses to find .m files so that export_fig.m is always found.

Please read the README file and File Information on File Exchange for documentation.  In particular, you will need to install ghostscript.


Here is an example to illustrate using export_fig...

% Set the default text sizes for the root figure

% Set the background color to white

% Here is a example figure
xlabel('Distance [m]')
ylabel('Force [N]')
grid on;

% Now call export_fig to generate a png image file at 300 dpi
export_fig example.png -png -r300 -painters

If all goes well you should now have an image file "example.png" in your current working directory that looks like this...

MATLAB Wrappers

Personally, I get tired of typing all of that - or putting it all in each script - so I have some convenience functions that I use when creating figures for publication.  These functions are in the frlbox github repository

The figure export scripts I use are in the figbox folder ( pubfig.m and exfig.m


  • No labels