Frequently, when I'm bantering about MATLAB at cocktail parties, the question of how to create "publication-quality" graphics from MATLAB arises. Many of you do great work using our tools, but are stymied when it comes time to publish your results with high-end plots and figures. To address these questions, I've started maintaining a list of resources that facilitate the creation of such graphics; Oliver's "export_fig" has recently found its way onto my list.
Function export_fig is described on the File Exchange with this verbiage:
This function saves a figure or single axes to one or more vector and/or bitmap file formats, and/or outputs a rasterized version to the workspace, with the following properties:
- Figure/axes reproduced as it appears on screen
- Cropped borders (optional)
- Embedded fonts (vector formats)
- Improved line and grid line styles
- Anti-aliased graphics (bitmap formats)
- Render images at native resolution (optional for bitmap formats)
- Transparent background supported (pdf, eps, png)
- Semi-transparent patch objects supported (png only)
- RGB, CMYK or grayscale output (CMYK only with pdf, eps, tiff)
- Variable image compression, including lossless (pdf, eps, jpg)
- Optionally append to file (pdf only)
- Vector formats: pdf, eps
- Bitmap formats: png, tif, jpg, bmp, export to workspace
This function is especially suited to exporting figures for use in publications and presentations, because of the high quality and portability of media produced.
There are several things I particularly like about export_fig. (Others have liked it, too; as of this writing, the entry was downloaded 737 times in the last month alone, and has an average user rating of 4.9 out of 5, from 28 ratings!) The code is well-implemented, and appears to be pretty robust. Also, the function is nicely documented (though it might be useful to include an example or two).
I also like how responsive Oliver has been in responding to queries and suggestions. The file has been updated 21 times (!) since it was originally posted in April, 2009, largely in response to user suggestions and bug reports. That's responsive, and great use of the MATLAB Central File Exchange!
MathWorker Ben Hinkle wrote a two-part MATLAB Digest article many years ago that has stood the test of time. In part 1, he discussed the issue, and introduced his exportfig, with which one could control basic graphic properties and create EPS figures. In part 2, Ben also provided some additional functions, including the ability to preview or restore figures.
Finally, these doc pages might be useful in this regard:
Get the MATLAB code
Published with MATLAB® 7.10