Skip to Main Content Skip to Search
Product Documentation

Printing Graphics

Overview of Printing

You can print a MATLAB figure directly on a printer connected to your computer or you can export the figure to one of the standard graphics file formats that MATLAB supports. There are two ways to print and export figures:

The print command provides greater control over drivers and file formats. The Print Preview dialog box gives you greater control over figure size, proportions, placement, and page headers. You can sometimes notice differences in output as printed from a GUI and as printed from the command line.

Printing from the File Menu

There are two menu options under the File menu that pertain to printing:

Use Print Preview to determine whether the printed output is what you want. Click the Print Preview dialog box Help button to display information on how to set up the page.

See Printing the Graph for an example of printing from the Print Preview dialog. For details on printing from GUIs and from the Command Window, see "Printing and Exporting" in the MATLAB Graphics documentation.

Exporting the Figure to a Graphics File

The Export Setup option in the File menu opens a GUI that enables you to set graphic characteristics, such as text size, font, and style, for figures you save as graphics files. The Export Setup GUI lets you define and apply templates to customize and standardize output. After setup, you can export the figure to a number of standard graphics file formats such as EPS, PNG, and TIFF.

See Exporting the Graph for an example of exporting a figure to a graphics file.

Using the Print Command

The print command provides more flexibility in the type of output sent to the printer and allows you to control printing from function and script files. The result can be sent directly to your default printer or stored in a specified output file. A wide variety of output formats, including TIFF, JPEG, and PostScript, is available.

For example, this statement saves the contents of the current figure window as color Encapsulated Level 2 PostScript in the file called magicsquare.eps. It also includes a TIFF preview, which enables most word processors to display the picture.

print -depsc2 -tiff magicsquare.eps

To save the same figure as a TIFF file with a resolution of 200 dpi, use the following command:

print -dtiff -r200 magicsquare.tiff

If you type print on the command line

print

the current figure prints on your default printer.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS