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 (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, whilst 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 at:
This submission was originally created by Oliver Woodford, but since January 2015 it has been maintained by Yair Altman.
When reporting bugs, please either use the 'Contact Author' link on my Author page, or raise an issue via GitHub. Please do not paste the error into the comments - I will not respond to these.