Graphics    

Changing the Figure's Settings

This section tells you how to use the Page Setup dialog box or the command line to change:

Using the Printing Options or Document Properties dialog boxes, or the command line, you can also control these settings:

Examples

These examples show you how to change specific settings from the Windows and the UNIX menus, and from the command line:

Size of the Figure

These properties control the size of the printed figure on the page. In some cases, they also control the position. See Position of the Figure on the Page for properties that control position.

Action
Page Setup Dialog Box
Command Line
Print figure at 8-by-6 inches
Size and Position tab. Set the Mode to Use manual size and position. MATLAB prints the figure at 8-by-6 inches and centers it on the page (if you have not changed the default).
Note: You can also make this change from the UNIX Print dialog box.
Set PaperPositionMode property to 'manual'. This is the default.
Print figure at screen size
Size and Position tab. Set the Mode to Use screen size, centered on page. MATLAB prints the figure the same size it is on the screen. If you select this option, you cannot change the Top, Left, Width and Height fields. However, they are updated to show the position and screen size of the figure.
Note: You can also make this change from the UNIX Print dialog box.
Set PaperPositionMode property to 'auto'.
Set the height and width of the figure
Size and Position tab. Set the Width and Height fields to the desired size of the figure. MATLAB prints the figure with these dimensions. The Width and Height fields are initially set to 8.00 and 6.00 inches respectively.
Mode must be set to Use manual size and position.
Set PaperPosition property to a 4-element vector [leftmargin, bottommargin, width, height].

    Note    Alternatively, you can change the size of the screen figure by clicking and dragging its borders, then printing it at screen size.

Size the figure interactively
Set the size of the printed figure by dragging the figure boundaries in the preview image on the right side of the dialog box. The Width and Height fields are updated to show the print size of the figure.
Mode must be set to Use manual size and position.
Not available
Fill the page
Size and Position tab. Click on Fill page. MATLAB prints the figure to fill the page, with a margin of 0.25 inches on all four sides. The Width and Height fields are updated to show the print size of the figure.
Mode must be set to Use manual size and position.
Set PaperPosition property to a 4-element vector [leftmargin, bottommargin, width, height].
Use the value of the PaperSize property ([width, height]) to calculate desired figure size.
Fix the aspect ratio
Size and Position tab. Click on Fix aspect ratio. MATLAB resizes the printed figure to have the same aspect ratio as the screen figure. The aspect ratio is equal to the width divided by the height. The Width and Height fields are updated to show the new print size of the figure.
Mode must be set to Use manual size and position.
Set PaperPosition property to a 4-element vector [leftmargin, bottommargin, width, height].
Get the figure's Position property ([leftscreenmargin, bottomscreenmargin, width, height]) to calculate the aspect ratio of the screen figure window.

Position of the Figure on the Page

These properties control the position of the printed figure on the page.

Action
Page Setup Dialog Box
Command Line
Set the figure margins
Size and Position tab. Set the Top and Left fields to the size of the desired margins. MATLAB positions the figure using these margins. The Top and Left fields are initially set to 2.50 and .25 inches respectively.
Mode must be set to Use manual size and position.
Set PaperPosition property to a 4-element vector [leftmargin, bottommargin, width, height].
Note: PaperPosition sets the bottom margin, rather than the top margin.
Center the figure
Size and Position tab. Click on Center. MATLAB centers the figure horizontally and vertically on the page.
Mode must be set to Use manual size and position.
Set PaperPosition property to a 4-element vector [leftmargin, bottommargin, width, height].
Get the PaperSize property ([paperwidth, paperheight]) to calculate desired margins.
Position the figure interactively
Position the printed figure by dragging the figure in the preview image on the right side of the dialog box. The Top and Left fields are updated to show the new margins.
Mode must be set to Use manual size and position.
Not available

Units of Measure

This property controls the units in which all values that describe the size and position of the printed figure are shown on the dialog boxes or returned on the command line.

Action
Page Setup Dialog Box
Command Line
Set the units of measure
Size and Position and Paper tabs. Select the desired units from the list under Units. The Top, Left, Width and Height fields in the Size and Position tab are automatically converted to the selected units.
Mode must be set to Use manual size and position.
Inches, centimeters, and points are absolute units. (One point equals 1/72 of an inch.) Normalized units are relative to the paper size, namely, they map the lower-left corner of the figure to (0,0) and the upper-right corner to (1.0, 1.0).
Set the PaperUnits property. Possible values are 'inches', 'centimeters', 'points', and 'normalized'. The default is 'inches'.
This setting applies to all values you set or get using the PaperPosition property.

Paper Size and Type

These properties enable you to select by type or by size, the paper on which the figure is printed.

Action
Page Setup Dialog Box
Command Line
Set the paper type
Paper tab. Use the list under Paper size to select from a list of predefined "paper types." The paper Width and Height fields are updated automatically to reflect the dimensions for your chosen paper type.
If you are a Windows user, the list shows the paper types supported by the current printer. If you are a UNIX user, the list shows MATLAB's built-in paper types. By default, MATLAB selects portrait format 8.5-by-11.0 inch paper, if available.
Set the PaperType property. Some possible values are 'usletter' (8.5-by-11 inches), 'uslegal' (11-by-14 inches), 'tabloid' (11-by-17 inches), 'A4' (210-by-297 mm).
See the Figure Properties reference page for a list of paper types.
Set the paper width and height
Paper tab. Set the Width and Height fields to the desired paper width and height if you cannot find a suitable paper type in the Paper size list. Paper size is automatically updated to show a paper type of <custom>. When the paper type is set to <custom>, the paper size is handled by the printer.
Set PaperSize property to a 2-element vector [paperwidth, paperheight].
Set the paper orientation
Paper tab. Click on one of the Orientation option buttons:
Portrait - Specifies that the longer paper dimension is oriented vertically with respect to the figure.
Landscape - Orients the longer paper dimension horizontally.
Rotated -Equivalent to rotating the paper 180º from landscape orientation. If Rotated is not supported by the current printer, the figure prints with landscape orientation.
Set the PaperOrientation property. Possible values are 'portrait', 'landscape', and 'rotated'. The default is 'portrait'.
You can use the orient function if you want the figure centered on the paper.

Attributes of Lines, Text, and Background

By default, MATLAB forces the figure background to white, but retains colors used in the figure. These properties enable you to override this default behavior.

Action
Page Setup Dialog Box
Command Line
Force line and text objects to black and white
Lines and Text tab. Click on the Black and white option in the Lines and Text tab. The lines and text are printed all black or all white, depending on the background color. This setting is recommended for use with black and white printers because colored lines and text are dithered to gray that may not be suitable for thin lines and text characters.
Specify the device as a black-and-white printer or graphics format. See the print reference page for a list of printers (i.e., drivers) and graphics formats.
Keep the screen color for lines and text
Lines and Text tab. Click on the Color (don't convert) option in the Lines and Text tab. The text and solid colored lines are printed in the same color as they are on the screen. If you are using a black and white printer, all of your text and solid colored lines are converted to shades of gray.
This is the default.
Force the figure background to white
Axes and Figure tab. Click on the Force white background option in the Axes and Figure tab. MATLAB prints the figure with white axes and figure backgrounds. This setting is intended to save on toner and may produce better-looking printed results.
Set the InvertHardCopy property to 'on'. This is the default.
Keep the figure background in the screen color
Axes and Figure tab. Click on the Keep screen background color option in the Axes and Figure tab. MATLAB prints the figure using the screen colors for both the axes and figure backgrounds. If you select this option and use a black and white printer, the background colors are dithered to shades of gray.
Set the InvertHardCopy property to 'off'.

If you have a black and white printer, you may want to read Getting the Best Results with Black-and-White Printers.

Axes, Tick Marks, and Uicontrols

By default, MATLAB recomputes the tick marks and the axes limits based on the size of the printed figure. It also retains uicontrols in the figure. These properties enable you to override this default behavior.

Action
Page Setup Dialog Box
Command Line
Recompute axes limits and ticks
Axes and Figure tab. Click on the Recompute axes limits and ticks option. MATLAB scales the number and placement of tick marks and the limit values of the axes depending on the size of the printed figure.
Note: You can also make this change in the UNIX Print dialog box.
Set the XTickMode, YTickMode, and ZTickMode properties to 'auto'. This is the default.
Keep screen limits and ticks
Axes and Figure tab. Click on the Keep screen limits and ticks option. MATLAB keeps the same number of ticks and the same limit values in the printed figure as are in the screen figure.
Note: You can also make this change in the UNIX Print dialog box.
Set the XTickMode, YTickMode, and ZTickMode properties to 'manual'.
Keep or suppress printing of UI controls
Axes and Figure tab. Deselect Print UIControls if you do not want uicontrols to appear in the printed figure. If you leave this check box selected, any uicontrols in the figure appear in the printout.
Uicontrols include push buttons, listboxes, sliders, pop-up menus, editable text boxes, and check boxes that you can add to a figure. See the uicontrol reference page for a complete list.
Use print -noui to suppress the uicontrols. The default is to keep the uicontrols.

Rendering the Figure

A renderer is software and/or hardware that draws the figure you see on the screen in a file, or formats it for a printer. By default, MATLAB chooses a renderer.

Action
Page Setup Dialog Box
Command Line
Let MATLAB choose the renderer
Axes and Figure tab. Select Default (auto mode) in the Figure renderer list. MATLAB selects a rendering method based on the complexity of the figure and the settings of various Handle Graphics properties. This setting usually produces a satisfactory printout.
See the Figure Properties reference page for information about MATLAB's autoselection criteria.
This is the default.
Select a specific renderer
Axes and Figure tab. MATLAB uses the renderer you select from the Figure renderer list to render the figure. Select Painter's if you want to print using vector graphics. Select Z-buffer or OpenGL if you want to print using raster (bitmap) graphics.
Set the Renderer property to 'painters', 'zbuffer', or 'OpenGL'.

For more information on setting the rendering method, see


 From the Command Line Printing the Figure