Graphics    

Exporting Problems

Background Color

I generated a figure with a black background and selected "Use figure color" from the Copy Options panel of the Preferences dialog box. But when I exported my figure, its background was changed to white.   

You must have exported your figure to a file. The settings in Copy Options only apply to figures copied to the clipboard.

There are two ways to retain the displayed background color: use the Page Setup dialog box or set the InvertHardCopy property to off. See Setting the Background Color for instructions on either method.

Default Settings

I want to export all of my figures using the same size. Is there some way to do this so that I don't have to set the size for each individual figure?.   

You can set the default value for any property by adding a line to startup.m. Adding the following line sets the default figure size to 4-by-3 inches.

In your call to set, combine the word Default with the name of the object Figure and the property name PaperPosition.

I use the clipboard to export my figures as metafiles. Is there some way to force all of my copy operations to use the metafile format?.   

Use the Copy Options panel of the Preferences dialog box. Any settings made here, including whether MATLAB copies your figure as a metafile or bitmap, apply to all copy operations. See Exporting to the Windows Clipboard for instructions.

Microsoft Word

I exported my figure to an EPS file, and then tried to import it into my Word document. My printout has an empty frame with an error message saying that my EPS picture was not saved with a preview and will only print to a PostScript printer. How do I include a TIFF preview?.   

Use the print command with the -tiff switch. For example:

Note that if you print to a nonPostScript printer with Word, the preview image is used for printing. This is a low-resolution image that lacks the quality of an EPS graphic. For more information about preview images and other aspects of EPS files, see EPS Files.

When I try to resize my figure in Word, its quality suffers.   

You must have used a bitmap format. Bitmap files generally do not resize well. If you are going to export using a bitmap format, try to set the figure's size while it's still in MATLAB. See Setting the Figure Size and Position for instructions.

As an alternative, you can use one of the vector formats, EMF or EPS. Figures exported in these formats can be resized in Word without affecting quality.

I exported my figure as an EMF to the clipboard. When I paste it into Word, some of the labels are printed incorrectly.   

This problem occurs with some versions of Word and Windows. Try editing the labels in Word.

File Format

I tried to import my exported figure into a word processing document, but I got an error saying the file format is unrecognized.   

There are two likely causes: you used the print function and forgot to specify the export format, or your word processing program does not support the export format. Include a format switch when you use the print function; simply including the file extension is not sufficient. For instructions, see Exporting to a File.

If this does not solve your problem, check what formats the word processor supports.

I tried to append a figure to an EPS file, and received an error message.   

You cannot append figures to an EPS file. The -append option is only valid for PostScript files, which should not be confused with EPS files. PostScript is a printer driver; EPS is a graphics file format.

Of the supported export formats, only HDF supports storing multiple figures, but you must use the imwrite function to append them. For an example, see the reference page for imwrite.

Size of Exported File

I've always used the EPS format to export my figures, but recently it started to generate huge files. Some of my files are now several megabytes!.   

Your graphics have probably become complicated enough that MATLAB is using the OpenGL or Z-buffer renderer instead of the Painter's renderer. It does this to improve display time or to handle attributes that Painter's cannot, such as lighting. However, using OpenGL or Z-buffer causes a bitmap to be stored in your EPS file, which sometimes leads to a large file.

There are two ways to fix the problem. You can specify the Painter's renderer when you export to EPS, or you can use a bitmap format, such as TIFF. The best renderer and type of format to use depend upon the figure. See Bitmap or Vector Graphics if you need help deciding. For information about the rendering methods and how to set them, see the section on Selecting a Renderer.

Making Movies

I am processing a large number of frames in MATLAB. I would like these frames to be saved as individual files for later conversion into a movie. How can I do this?.   

Use getframe to capture the frames, imwrite to write them to a file, and movie to create a movie from the files. For more information about using getframe and imwrite to capture and write the frames, see Exporting with getframe. For more information about creating a movie from the captured frames, see the reference page for movie.

You can also save multiple figures to an AVI file. AVI files can be used for animated sequences that do not need MATLAB to run. However, they do require an AVI viewer. For more information, see Creating an AVI Format Movie in the "Development Environment" section of the Using MATLAB documentation.

Extended Operations

There are some Export operations that cannot be performed using the Export dialog box.   

You need to use the print function to do any of the following operations:


  Printing Problems General Problems