Printing and Exporting Figures with MATLAB | ![]() ![]() |
Details About Selected File Formats
This section contains details about some of the export file formats MATLAB supports. The formats are those which give particularly high quality results, or are popular, affected by optional settings, or require special consideration. For information about formats not listed here, consult a graphics file format reference.
Adobe Illustrator 88 Files
Adobe Illustrator (ILL) is a vector format that is fully compatible with Adobe Illustrator software. An Illustrator file created in MATLAB can be further processed with Adobe Illustrator running on any platform. (Note that when you view it in Illustrator, it will have no template.)
By default, Illustrator files are color and saved in portrait orientation. The Illustrator group
command is used to give the illustrations a hierarchy similar to that of the Handle Graphics or Simulink graphic.
Some limitations of the Illustrator format are:
CData
values for all of the polygon's vertices.
EMF Files
Enhanced Metafiles (EMF) are vector files similar in nature to Encapsulated PostScript (EPS), capable of producing near publication-quality graphics. EMF is an excellent format to use if you plan to import your image into a Microsoft application and want the flexibility to edit and resize your image once it's been imported. It is the only MATLAB-supported vector format you can edit from within a Microsoft application. (Note that your editing ability is limited. For the best results, do all of your editing in MATLAB.)
A drawback of using EMF files is that they are generally only supported by Windows-based applications.
See also Example - Exporting an EMF to the Clipboard.
The Encapsulated PostScript (EPS) vector format is the most reliable and consistent file format MATLAB supports. It is widely recognized in desktop publishing and word processing packages on both UNIX and Windows. EPS is the only MATLAB-supported export format that can produce CMYK output. (PostScript printer drivers also support this feature.)
This format is your best choice for producing publication-quality graphics. It may not be appropriate for figures containing interpolated shading because it creates a very large file that is difficult to print. For such figures, use the TIFF format with a high resolution setting. For more information about format choices see Bitmap and Vector Formats.
When imported into Microsoft applications, an EPS file will not display unless you add a TIFF preview image to it.
The preview image is simple to add (see Creating a Preview Image below). However, if you print your file to a nonPostScript printer, the TIFF preview is used as the printed image. The resolution of the preview image is 72 dpi, resulting in much lower quality than the EPS image. If there is no preview image, your printout to a nonPostScript printer contains an error message in place of the graphic. Many high-end graphics packages, like Adobe Illustrator, can print an EPS file to a nonPostScript printer.
When using EPS files in Microsoft applications, figures cannot be edited; they can only be annotated.
Note The best vector format to use with Microsoft applications is EMF. See EMF Files. |
EPS format has limited font support. When MATLAB exports a graphic to the EPS file format, it does not try to determine whether the fonts you have used in your axes text objects are supported by the EPS format. Unsupported fonts are substituted with Courier. The fonts supported by EPS files are the same as those supported for PostScript files. See PostScript and Ghostscript Supported Fonts for more information.
The three options for exporting EPS files: preview images, CMYK output, and uncropped background, are described below.
Creating a Preview Image. You cannot create TIFF preview images using the graphical user interface. Use the print
command with the -tiff
switch. For example,
Exporting EPS as CMYK . By default, MATLAB produces color output based on red, green, and blue (RGB) color values. If you plan to publish MATLAB figures using four-color separations, you may want to use CMYK (cyan, magenta, yellow, black) color values instead of RGB. See Creating CMYK Output for instructions.
Exporting an Uncropped EPS. By default, MATLAB crops most figures when exporting or printing. EPS and other Ghostscript-supplied formats enable you to override this by setting a "loose" bounding box. This is important if you have intentionally used space between uicontrols
or axes
and the edge of the figure and you want to maintain this appearance in the printed output. See Producing Uncropped Output for instructions and a picture of how an uncropped figure looks.
The JPEG bitmap format is one of the dominant formats used in web graphics. The 24-bit version MATLAB uses supports more colors than the popular GIF format.
JPEG files always use JPEG compression. This is a lossy compression scheme, meaning that some data is thrown away during compression. When you export to a JPEG image, you can set the amount of compression to use. The more compression you use, the more data is thrown away. The compression amount is referred to as JPEG quality, where the highest setting results in the highest quality image but the lowest amount of compression.
Setting JPEG Quality. You cannot set the quality using the graphical user interface. Use the print
command with the -djpeg
format switch, including the desired quality value as a suffix. This example exports to a JPEG file using a quality setting of 100.
By default, MATLAB uses a quality setting of 75. Possible values are from 1 to 100. Note that the highest setting of 100 still results in some data loss, although the result is usually visually indistinguishable from the original.
TIFF Files
The TIFF format is a very widely used bitmap format and can produce publication-quality graphics if you use a high resolution setting (such as 200 or 300 dpi).
TIFF is a good format to choose if you are not sure what formats your target application supports, or if you want to import the graphic into more than one application without having to export it to several different formats. It can also be imported into most image processing applications and converted to other formats, if needed. For example, MATLAB does not produce GIF files (due to patent restrictions), but there are many applications that can convert TIFF files to GIF.
![]() | Setting the Export File Format | How to Choose a File Format | ![]() |