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/padded borders (optional)
- Embedded fonts (pdf only)
- 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, tiff)
- Vector formats: pdf, eps
- Bitmap formats: png, tiff, 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.
Note that the background color and figure dimensions are reproduced (the latter approximately, and ignoring cropping & magnification) in the output file. For transparent background (and semi-transparent patch objects), use the -transparent option, and set the axes 'Color' property to 'none' where desired. Pdf, eps and png are the only file formats to support a transparent background, while the png format alone supports transparency of patch objects.
When exporting to vector format (pdf & eps), and to bitmap using the painters renderer, this function requires that ghostscript is installed on your system. You can download this from:
When exporting to eps it additionally requires pdftops, from the Xpdf suite of functions. You can download this from:
Usage examples and tips can be found in the README section at:
A technical description of the various components can be found here:
This submission was originally created by Oliver Woodford. Yair Altman maintains this utility since Jan 2015.
When reporting bugs, please raise an issue via GitHub: https://github.com/altmany/export_fig/issues
Do not paste the error into the comments below - I will not respond to these.