Graphics    

What Is Printed or Exported

A printed or exported figure includes the area inside the figure window frame. The figure can include axis labels, uicontrols, and annotations.

Which Figure Is Printed

By default, MATLAB prints the current figure. If you have more than one figure open, the current figure is the last active figure. Set the current figure:

How to Print or Export

This is an overview of the ways you can print or export a figure in MATLAB. Subsequent sections of this chapter contain more detail.

Action
Ways to Print or Export a Figure
Print a figure to a printer or to a file.

Select Print from the figure window's File menu.

Use the print command

Export a figure to a file in graphics format.

Select Export from the figure window's File menu.

Use the print command.

Export a figure to the clipboard in graphics format.

Select Copy Figure from the figure window's Edit menu.

Use the print command.

Default Settings and How to Change Them

If you have not changed the default print and export settings, MATLAB prints or exports the figure:

Changing Settings for a Figure

In general, to change the property settings for a specific figure:

The settings you change with the Page Setup, Print, and Options dialog boxes, and with the set command are saved with the figure and affect each print of the figure until you change the settings again.

The settings you change with the Figure Copy Template Preferences and Copy Options Preferences panels alter the figure as it displays on the screen. The Figure Copy Template Preferences panel enables you to restore the figure to its original state.

Some settings can also be changed for the current print operation by specifying options to the print command.

See Changing the Figure's Settings for more information.

Changing Session Defaults

MATLAB enables you to set the session defaults for figure properties. Set the session default for a property using the syntax

where propertyname is one of the named figure properties. This example sets the paper orientation for all subsequent print operations in the current MATLAB session.

The Figure Properties reference page contains a complete list of the properties.

Changing Session-to-Session Defaults

MATLAB enables you to set the session-to-session defaults for figure properties, the print device, and the print command. The print device can be either a printer or a graphics format in which figures are exported.

Print Device and Print Command.   Set the default print device and the default print command in your printopt.m file. This file contains instructions for changing these settings and for displaying the current defaults. Open printopt.m in your editor by typing the command

Scroll down about 40 lines until you come to this comment line and make your changes after this line.

Figure Properties.   Set the session-to-session default for a property by including this command in your startup.m file.

where propertyname is one of the named figure properties. For example,

keeps the figure background in the screen color.

This is the same command you use to change a session default, except that it executes automatically every time MATLAB is invoked. The Figure Properties reference page contains a complete list of the properties.

Colored Lines and Text.   In Windows, you can set the session-to-session default for how colored lines and text are sent to the printer in the Figure window printing box on the General Preferences panel. You can override this default setting for a specific figure from the Lines and Text tab on the figure's Page Setup dialog box.


 Overview of Printing and Exporting Printing a Figure to a Printer or a File