Choosing a Graphics Format

A graphics file format is a specification for storing and organizing data in a file. MATLAB supports many different graphics file formats. Some are built into MATLAB and others are Ghostscript formats. File formats also differ in color support, graphics style (bitmap or vector), and bit depth.

This section provides information to help you decide which graphics format to use when exporting your figure to a file or to the Windows clipboard. It covers

Before deciding on a graphics format, check what formats are supported by your target application and platform. See the print reference page for a complete list of graphics formats supported in MATLAB. Once you decide on which format to use in exporting your figure, follow the instructions in Exporting to a File or Exporting to the Windows Clipboard.

Frequently Used Graphics Formats

Here are some of the more frequently used graphics formats. For a complete list, see the Graphics Format table on the print reference page. For a more complete description of these formats, see Description of Selected Graphics Formats.

Command Line -device Parameter
EPS color, and black and white
Export line plots or simple graphs to a file.
Note. An EPS file does not display within some applications unless you add a TIFF preview image to it. See the example Exporting in EPS Format with a TIFF Preview.
-deps (black and white)
-depsc (color)
-depsc -tiff
(TIFF preview)
JPEG 24-bit
Export plots with surface lighting or transparency to a file. This format can be displayed by most Web browsers.
where number is the compression.
TIFF 24-bit bitmap color
Export plots with surface lighting or transparency to a file. Widely available. A good format to choose if you are not sure what formats your application supports.
BMP 8-bit color bitmap
Export a figure to the clipboard (Windows only).
EMF color vector format
Export a figure to the clipboard (Windows only).

Factors to Consider in Choosing a Format

There are at least five main factors to consider when choosing a graphics format to use in exporting a figure:

The Graphics Format table shown on the print reference page provides information on the first four of these items for each format that MATLAB supports.

Built-In MATLAB or Ghostscript Formats

Some graphics formats are built-in MATLAB formats and others are provided by Ghostscript. In some cases (such as the Windows Bitmap format), the format is available both as a built-in format and a Ghostscript format. In general, when this is the case, we recommend that you choose the MATLAB format, especially if you plan to read the image back into MATLAB later.

The choice of MATLAB versus Ghostscript is important when any of these properties affect your output:

Bitmap or Vector Graphics

MATLAB file formats are created using either bitmap or vector graphics. Bitmap formats store graphics as matrices of pixels. Vector formats use drawing commands to store graphics as geometric objects. Whether to use a bitmap or vector format depends mostly on the type of objects in your figure.

The choice of bitmap versus vector graphics is important when any of these properties or capabilities affect your output:

Bit Depth

Bit depth is the number of bits a format uses to store each pixel. This determines the number of colors the exported figure can contain.

Bit depth applies mostly to bitmap graphics. An 8-bit image uses 8 bits per pixel (bpp), enabling it to define 28, or 256 unique colors. The other supported bit depths are 1-bit (2 colors), 4-bit (16 colors), and 24-bit (16 million colors).

In vector files that don't normally have a bit depth, the color of objects is specified by drawing commands stored in the file. However, vector files can contain bitmaps under the following conditions:

The Graphics Format table on the print reference page indicates the bit depth of each format. If file size is not critical, make sure you choose a format with a bit depth that supports the number of colors or shades of gray in your displayed figure.

Color Support

Each graphics format can produce either color, grayscale, or monochrome output. Check the Graphics Format table to see the level of color support for each format type. To preserve the color in your exported file, you must select a color graphics format. Color is also affected by bit depth.

Simulink Models

Simulink models can only be exported to EPS or a Ghostscript format. Note that you can only use the print function to export a model, not the Export dialog box.

High Resolution or Web Publications

If you want to use a figure in a journal or other publication, use a format that enables you to set a high resolution. We recommend using either TIFF or EPS.

If you want to use a figure in a Web publication, you should use either the PNG or the JPEG format. Note that if you need a GIF image, you can export your figure as a TIFF file and convert it to a GIF using another software application.

  Producing Uncropped Figures Properties Affected by Choice of Format