| MATLAB® | ![]() |
The table below shows parameters that you can set before submitting your figure to the printer.
The Parameter column lists all parameters that you can change.
The Default column shows the MATLAB® default setting.
The Dialog Box column shows which dialog box to use to set that parameter. If you can make this setting on only one platform, this is noted in parentheses: (W) for Windows®, and (U) for UNIX®.
Some dialog boxes have tabs at the top to enable you to select a certain category. These categories are denoted in the table below using the format <dialogbox>/<tabname>. For example, Print Preview/Layout... in this column means to use the Print Preview dialog box, selecting the Layout tab.
The print Command or set Property column shows how to set the parameter using the MATLAB print or set function. When using print, the table shows the appropriate command option (for example, print -loose). When using set, it shows the property name to set along with the type of object (for example, (Line) for line objects).
Parameter | Default | Dialog Box | print Command or set Property |
|---|---|---|---|
Last active window | None | print -fhandle | |
System default | print -pprinter | ||
8-by-6 inches | Print Preview/Layout | PaperSize (Figure) PaperUnits (Figure) | |
0.25 in. from left, 2.5 in. from bottom | Print Preview/Layout | PaperPosition (Figure) PaperUnits (Figure) | |
Manual | Print Preview/Layout | PaperPositionMode (Figure) | |
Letter | Print Preview/Layout | PaperType (Figure) | |
Portrait | Print Preview/Layout | PaperOrientation (Figure) | |
Selected automatically | Print Preview/Advanced | print -zbuffer | -painters | -opengl | |
Auto | Print Preview/Advanced | RendererMode (Figure) | |
Depends on driver or graphics format | Print Preview/Advanced | print -rresolution | |
Recompute | Print Preview/Advanced | XTickMode, etc. (Axes) | |
Force to white | Print Preview/Color | Color (Figure) InvertHardCopy (Figure) | |
As in the figure | Print Preview/Lines/Text | FontSize (Text) | |
Regular font | Print Preview/Lines/Text | FontWeight (Text) | |
As in the figure | Print Preview/Lines/Text | LineWidth (Line) | |
Black or white | Figure Copy Template | LineStyle (Line) | |
Black and white | Print Preview/Lines/Text | Color (Line, Text) | |
RGB color | Print Preview/Color (U) | print -cmyk | |
Printed | Print Preview/Advanced | print -noui | |
Tight | N/A | print -loose | |
Transparent | Copy Options (W) | See "Background color" | |
Same as screen size | Copy Options (W) | See "Figure Size" |
By default, the current figure prints. If you have more than one figure open, the current figure is the last one that was active. To make a different figure active, click it to bring it to the foreground.
Specify a figure handle using the command
print -fhandle
This example sends Figure No. 2 to the printer. A figure's number is usually its handle.
print -f2
You can select the printer you want to use with the Print dialog box or with the print function.
You can select the printer using the -P switch of the print function.
This example prints Figure No. 3 to a printer called Calliope.
print -f3 -PCalliope
If the printer name has spaces in it, put single quotation marks around the -P option, as shown here.
print '-Pmy local printer'
Using a Network Print Server. On Windows systems, you can print to a network print server using the form shown here for a printer named trinity located on a computer named PRINTERS.
print -P\\PRINTERS\trinity
Note On Windows platforms, when you use the -P option to identify a printer to use, if you specify any driver other than -dwin or -dwinc, MATLAB output goes to a file with an appropriate extension but does not send it to the printer; you can then copy that file to a printer. |
The default output figure size is 8 inches wide by 6 inches high, which maintains the aspect ratio (width to height) of the MATLAB figure window. The figure's default position is centered both horizontally and vertically when printed to a paper size of 8.5-by-11 inches.
You can change the size and position of the figure:
Select Print Preview from the figure window's File menu to open the Print Preview dialog box. Click the Layout tab to make changes to the size and position of your figure on the printed page.
Use the text edit boxes on the left to enter new dimensions for your figure. Or, use the handlebars on the rulers in the right-hand pane to drag the margins and location of your figure with the mouse. The outer handlebars move the figure toward or away the nearest margin, while the central handlebar repositions the figure on the page without changing its proportions. Guidelines appear while you are using the handlebars.

Settings you can change in the Layout tab are as follows:
Placement. Choose whether you want the figure to be the same size as it is displayed on your screen, or you want to manually change its size using the options in the Layout pane.
When you select the Use manual size and position mode, type the widths of any of the four margins and the preview image responds after each entry you make. Select units of measure (inches/centimeters/points) with pushbuttons on the Units section on the bottom of the pane.
You can use the four buttons at the bottom of the Placement section to expand the figure to fill the page, make its aspect ratio (ratio of y-extent to x-extent) as printed match that of the figure, center the figure on the page, or restore the setup to what it was when you opened the Print Preview dialog. Selecting Fill page can alter the aspect ratio of your image. To get the maximum figure size without altering the aspect ratio, select Fix aspect ratio.
Auto (actual size, centered). Select this option to center the figure on the page; it will be the same size as it is in the figure window. The four buttons below the control are dimmed when you select this option.
Note Changes you make using Print Preview affect the printed output only. They do not alter the figure displayed on your screen. |
To print your figure with a specific size or position, make sure the PaperPositionMode property is set to manual (the default). Then set the PaperPosition property to the desired size and position.
The PaperPosition property references a four-element row vector that specifies the position and dimensions of the printed output. The form of the vector is
[left bottom width height]
where
left specifies the distance from the left edge of the paper to the left edge of the figure.
bottom specifies the distance from the bottom of the paper to the bottom of the figure.
width and height specify the figure's width and height.
The default values for PaperPosition are
[0.25 2.5 8.0 6.0]
This example sets the figure size to a width of 4 inches and height of 2 inches, with the origin of the figure positioned 2 inches from the left edge of the paper and 1 inch from the bottom edge.
set(gcf, 'PaperPositionMode', 'manual'); set(gcf, 'PaperUnits', 'inches'); set(gcf, 'PaperPosition', [2 1 4 2]);
Note PaperPosition specifies a bottom margin, rather than a top margin as Print Preview does. When you set the top margin using Print Preview, This setting is used to calculate the bottom margin, and updates the PaperPosition property appropriately. |
Set the paper size by specifying the dimensions or by choosing from a list of predefined paper types. If you do not set a paper size or type, the default paper size of 8.5-by-11 inches is used.
Paper-size and paper-type settings are interrelated—if you set a paper type, the paper size also updates. For example, if you set the paper type to US Legal, the width of the paper updates to 8.5 inches and the height to 14 inches.
You can change the paper size and orientation:
Select Print Preview from the figure window's File menu to open the Print Preview dialog box. Click the Layout tab to make changes to the paper type and orientation of the figure on the printed page.

Settings you can change in the Layout tab are as follows:
Paper Format, Units and Orientation. Select a paper type from the list under Format. If there is no paper type with suitable dimensions, enter your own dimensions in the Width and Height fields. Make sure Units is set appropriately to inches, centimeters, or points. If you change units after setting a paper width and height, the Width and Height fields update to use the units you just selected. The page region in the preview pane updates to show the new paper format or size when you change them.
Use the Orientation buttons to select how you want the figure to be oriented on the printed page. The illustration under Setting the Paper Orientation shows the three types of orientation you can choose from.
Note Changes you make using Print Preview affect the printed output only. They do not alter the figure displayed on your screen. |
Set the PaperType property to one of the built-in MATLAB paper types, or set the PaperSize property to the dimensions of the paper.
When you select a paper type, the unit of measure is not automatically updated. We recommend that you set the PaperUnits property first.
For example, these commands set the units to centimeters and the paper type to A4.
set(gcf, 'PaperUnits', 'centimeters'); set(gcf, 'PaperType', 'A4');
This example sets the units to inches and sets the paper size of 5-by-7 inches.
set(gcf, 'PaperUnits', 'inches'); set(gcf, 'PaperSize', [5 7]);
If you set a paper size for which there is no matching paper type, the PaperType property is automatically set to 'custom'.
Paper orientation refers to how the paper is oriented with respect to the figure. The choices are Portrait (the default), Landscape, and Rotated.
You can change the orientation of the figure:
The figure below shows the same figure printed using the three different orientations.

Note The Rotated orientation is not supported by all printers. When the printer does not support it, landscape is used. |
Select Print Preview from the figure window's File menu and select the Layout tab. (See Using the Graphical User Interface).
Use the PaperOrientation figure property or the orient function. Use the orient function if you always want your figure centered on the paper.
The following example sets the orientation to landscape:
set(gcf, 'PaperOrientation', 'landscape');
Centering the Figure. If you set the PaperOrientation property from portrait to either of the other two orientation schemes, you might find that what was previously a centered image is now positioned near the paper's edge. You can either adjust the position (use the PaperPosition property), or you can use the orient function, which always centers the figure on the paper.
The orient function takes the same argument names as PaperOrientation. For example,
orient rotated;

A renderer is software and/or hardware that processes graphics data (such as vertex coordinates) to display, print, or export a figure. You can change the renderer from the one used to draw a figure to another renderer when printing it:
MATLAB supports three rendering methods with the following characteristics:
Draws figures using vector graphics
Generally produces higher resolution results
The fastest renderer when the figure contains only simple or small graphics objects
The only renderer possible when printing with the HPGL print driver or exporting to an Adobe® Illustrator file
The best renderer for creating PostScript® or EPS files
Cannot render figures that use RGB color for patch or surface objects
Does not show lighting or transparency
Draws figures using bitmap (raster) graphics
Faster and more accurate than Painter's
Can consume a lot of system memory when displaying a complex scene
Shows lighting, but not transparency
Draws figures using bitmap (raster) graphics
Generally faster than Painter's or Z-buffer
Can access graphics rendering hardware available on some systems
Shows both lighting and transparency
For more detailed information about the rendering methods, see Renderer on the Figure Properties reference page.
By default, OpenGL tries to optimize the rendering method based on the attributes of the figure (its complexity and the settings of various Handle Graphics® properties) and in some cases, the printer driver or file format used.
In general, renderers are selected as follows:
Painter's, for line plots, area plots (bar graphs, histograms, etc.), and simple surface plots
Z-buffer, when the computer screen is not true color or when the opengl function was called with selection_mode set to neverselect
OpenGL, for complex surface plots using interpolated shading and any figure using lighting
The RendererMode property describes whether to automatically select the renderer based on the contents of the figure (when set to auto), or to use the Renderer property that you have indicated (when set to manual).
Two reasons to set the renderer yourself are
To make your printed or exported figure look the same as it did on the screen. The rendering method used for printing and exporting the figure is not always the same method used to display the figure.
To avoid unintentionally exporting your figure as a bitmap within a vector format. For example, high-complexity MATLAB plots typically render using OpenGL or Z-buffer. If you export a high-complexity figure to the EPS or EMF vector formats without specifying a rendering method, either OpenGL or Z-buffer might be used, each of which creates bitmap graphics.
Storing a bitmap in a vector file can generate a very large file that takes a long time to print. If you use one of these formats and want to make sure that your figure is saved as a vector file, be sure to set the rendering method to Painter's.
Open the Print Preview dialog box by selecting Print Preview from the figure window's File menu. Select the Advanced tab.
In the Renderer drop-down menu, select the desired rendering method from the list box.
You can use the Renderer property or a switch with the print function to set the renderer for printing or exporting. These two lines each set the renderer for the current figure to Z-buffer.
set(gcf, 'Renderer', 'zbuffer');
or
print -zbuffer
The first example saves the new value of Renderer with the figure; the second example only affects the current print or export operation.
Note that when you set the Renderer property, the RendererMode property is automatically reset from auto (the factory default) to manual.
Resolution refers to how accurately your figure is rendered when printed or exported. Higher resolutions produce higher quality output. The specific definition of resolution depends on whether your figure is output as a bitmap or as a vector graphic.
You can change the resolution used to print a figure:
The default resolution depends on the renderer used and the graphics format or printer driver specified. The following two tables summarize the default resolutions and whether you can change them.
Resolutions Used with Graphics Formats
Graphics Format | Default Resolution | Can Be Changed? |
|---|---|---|
Built-in MATLAB export formats, (except for EMF, EPS, and ILL) | 150 dpi (always use OpenGL or Z-buffer) | Yes |
EMF export format (Enhanced Metafile) | 150 dpi | Yes |
EPS (Encapsulated PostScript) | 150 dpi, if OpenGL or Z-buffer; 864 dpi if Painter's | Yes |
ILL export format (Adobe Illustrator) | 72 dpi (always uses Painter's) | No |
Ghostscript export formats | 72 dpi (always uses OpenGL or Z-buffer) | No |
Resolutions Used with Printer Drivers
Printer Driver | Default Resolution | Can Be Changed? |
|---|---|---|
Windows and PostScript drivers | 150 dpi, if OpenGL or Z-buffer; 864 dpi if Painter's | Yes |
Ghostscript driver | 150 dpi, if OpenGL or Z-buffer; 864 dpi if Painter's | Yes |
HPGL driver | 1116 dpi (always uses Painter's) | Yes |
You might need to determine your resolution requirements through experimentation, but you can also use the following guidelines.
For Printing. The default resolution of 150 dpi is normally adequate for typical laser-printer output. However, if you are preparing figures for high-quality printing, such as a textbook or color brochures, you might want to use 200 or 300 dpi. The resolution you can use can be limited by the printer's capabilities.
For Exporting. If you are exporting your figure, base your decision on the resolution supported by the final output device. For example, if you will import your figure into a word processing document and print it on a printer that supports a maximum resolution setting of 300 dpi, you could export your figure using 300 dpi to get a precise one-to-one correspondence between pixels in the file and dots on the paper.
Note The only way to set resolution when exporting is with the print function. |
Resolution affects file size and memory requirements. For both printing and exporting, the higher the resolution setting, the longer it takes to render your figure.
To set the resolution for built-in MATLAB printer drivers:
From the Print dialog box, click Properties. This opens a new dialog box. (This box can differ from one printer to another.)
You may be able to set the resolution from this dialog. If not, then click Advanced to get to a dialog box that enables you to do this.
Set the resolution, and then click OK. (The resolution setting might be labeled by another name, such as "Print Quality.")
If you use a Windows printer driver, you can only set the resolution using the Windows Document Properties dialog box.
Otherwise, to set the resolution for printing or exporting, the syntax is
print -rnumber
where number is the number of dots per inch. To print or export a figure using screen resolution, set number to 0 (zero).
This example prints the current figure with a resolution of 100 dpi:
print -r100
This example exports the current figure to a TIFF file using screen resolution:
print -r0 -dtiff myfile.tif
The default output size, 8-by-6 inches, is normally larger than the screen size. If the size of your printed or exported figure is different from its size on the screen, the number and placement of axes tick marks scale to suit the output size. This section shows you how to lock them so that they are the same as they were when displayed.
You can change the resolution used when printing a MATLAB figure:
Select Print Preview from the figure window's File menu to open the Print Preview dialog box. Select the Advanced tab to make changes to the axes, UI controls, or renderer settings.

Settings you can change in the Advanced tab are as follows, by panel:
Axes limits and ticks. If the size of your printed or exported figure is different from its size on the screen, the number and placement of axes tick marks scale to suit the output size. Select Keep screen limits and ticks to lock them so that they are the same as they were when displayed. If you want to automatically adjust the ticks and limits when scaling for printing, select Recompute limits and ticks.
Miscellaneous. Use the Renderer drop-down menu to specify which renderer to use in printing the figure. Set the renderer to Painters, Z-buffer, or OpenGL, or select auto to automatically decide which one to use, depending on the characteristics of the figure. (See Selecting a Renderer).
Use the Resolution drop-down menu to specify the resolution, in dots per inch (DPI), at which to render and print the figure. You can select 150, 300, or 600 DPI, or type in a different value (positive integer).
Figure UI Controls. By default, user interface controls are included in your printed or exported figure. Clear the Print UIControls check box to exclude them. (See Excluding User Interface Controls form Printed Output).
Note Changes you make using Print Preview affect the printed output only. They do not alter the figure displayed on your screen. |
To set the XTickMode, YTickMode, and ZTickMode properties to manual, type
set(gca, 'XTickMode', 'manual'); set(gca, 'YTickMode', 'manual'); set(gca, 'ZTickMode', 'manual');
You can keep the background the same as is shown on the screen when printed, or change the background to white. There are two types of background color settings in a figure: the axes background and the figure background. The default displayed color of both backgrounds is gray, but you can set them to any of several colors.
Regardless of the background colors in your displayed figure, by default, they are always changed to white when you print or export. This section shows you how to retain the displayed background colors in your output.
To retain the background color on a per figure basis:
Open the Print Preview dialog box by selecting Print Preview from the figure window's File menu. Select the Color tab.
If you are exporting your figure using the clipboard, use the Copy Options panel of the Preferences dialog box.
To retain your background colors, use
set(gcf, 'InvertHardCopy', 'off');
The following example sets the figure background color to blue, the axes background color to yellow, and then sets InvertHardCopy to off so that these colors appear in your printed or exported figure.
set(gcf, 'color', 'blue'); set(gca, 'color', 'yellow'); set(gcf, 'InvertHardCopy', 'off');
If you transfer your figures to Microsoft® Word or PowerPoint® applications, you can set line and text characteristics to values recommended for those applications. The Figure Copy Template Preferences dialog box provides Word and PowerPoint options to make these settings, or you can set certain line and text characteristics individually.
You can change line and text characteristics:
To open Figure Copy Template Preferences, select Preferences from the File menu, and then click Figure Copy Template in the left pane.

Settings you can change in the Figure Copy Template Preferences dialog box are as follows:
Microsoft® Word or PowerPoint®. Click Word or PowerPoint to apply recommended MATLAB settings.
Text. Use options under Text to modify the appearance of all text in the figure. You can change the font size, change the text color to black and white, and change the font style to bold.
Lines. Use the Lines options to modify the appearance of all lines in the figure:
Custom width — Change the line width.
Change style (Black or white) — Change colored lines to black or white.
Change style (B&W styles) — Change solid lines to different line styles (e.g., solid, dashed, etc.), and black or white color.
UIControls and axes. If your figure includes user interface controls, you can choose to show or hide them by clicking Show uicontrols. Also, to keep axes limits and tick marks as they appear on the screen, click Keep axes limits and tick spacing. To allow autoamtic scaling of axes limits and tick marks based on the size of the printed figure, clear this box.
Note Changes you make using Print Preview affect the printed output only. They do not alter the figure displayed on your screen. |
You can use the set function on selected graphics objects in your figure to change individual line and text characteristics.
For example, to change line width to 1.8 and line style to a dashed line, use
lineobj = findobj('type', 'line');
set(lineobj, 'linewidth', 1.8);
set(lineobj, 'linestyle', '--');
To change the font size to 15 points and font weight to bold, use
textobj = findobj('type', 'text');
set(textobj, 'fontunits', 'points');
set(textobj, 'fontsize', 15);
set(textobj, 'fontweight', 'bold');
When colored lines and text are dithered to gray by a black-and-white printer, it does not produce good results for thin lines and the thin lines that make up text characters. You can, however, force all line and text objects in the figure to print in black and white, thus improving their appearance in the printed copy. When you select this setting, the lines and text are printed all black or all white, depending on the background color.
The default is to leave lines and text in the color that appears on the screen.
Note Your background color might not be the same as what you see on the screen. See the Color tab for an option that preserves the background color when printing. |
You can change the resolution used to print a figure:
Select Print Preview from the figure window's File menu to open the Print Preview dialog box. Select the Lines and Text tab to make changes to the color of all lines and text on the printed page. The controls for the Lines and Text tab are shown below:

Settings you can change in Lines and Text are as follows:
Lines. The default option in this panel causes lines to print at the same width they are portrayed in the figure window. You can scale line width from 0 percent upwards for printing using the Scale By field. To print lines at a particular point size, select Custom. All lines on the plot will be the same weight when you use the Custom option; the Scale By option respects relative line weight.
When you scale lines downward, you can prevent them from becoming too faint by setting the Min Width option to Custom and specifying a minimum line width in points in that field.
Text. The default is to print text in the same font and at the same size as it is in the figure. To change the font (for all text) select Custom and choose a new font from the drop-down list that is then enabled. Scale the font size using the Scale By option. To print text at a particular point size, select Custom. All text on the plot will be printed at the point size you specify when you use the Custom option; the Scale By option respects relative font size. You can specify the Font Weight (normal, light, demi, or bold) and Font Angle (normal, italic, or oblique) for all text as well, using the drop-down menus at the bottom of the Text panel.
Header. Type any text that you want to appear at the top of the printed figure in the Header Text edit field. If you want today's date and/or time appended to the header text, select the appropriate format from the Date Style popup menu. To specify and style the header font (which is independent of the font used in the figure), click the Font button and choose a font name, size, and style from the Font selection window that appears.
Note Changes you make using Print Preview affect the printed output only. They do not alter the figure displayed on your screen. |
There is no equivalent MATLAB command that sets line and text color depending on background color. Set the color of lines and text using the set function on either line or text objects in your figure.
This example sets all lines and text to black:
set(findobj('type', 'line'), 'color', 'black');
set(findobj('type', 'text'), 'color', 'black');
By default, color output is in the RGB color space (red, green, blue). If you plan to publish and print MATLAB figures using printing industry standard four-color separation, you might want to use the CMYK color space (cyan, magenta, yellow, black).
Select Print Preview from the figure window's File menu to open the Print Preview dialog box. Select the Color tab to make changes to the color of all lines and text on the printed page. The controls for the Color tab are shown below:

You can print the contents of your figure in color, grayscale, or black-and-white by selecting the appropriate button in the panel. When you select Color, you can choose between an RGB (red/green/blue) or a CMYK (cyan/magenta/yellow/black) color specification, if your printer is capable of it.
Independently of the Color Scale controls, you can specify a Background color for printing. Select Same as figure to use the color used in the figure itself (default is gray), or specify a Custom color from the combo box popup menu. The choices are black, white, and several RGB color triplet values; you type any valid MATLAB colorspec in this field as well, such as g, magenta, or .3 .4 .5.
The background color you specify is respected even if you choose Black and White or Gray Scale in the Color Scale panel.
On any platform, you can also indicate whether to print in color, grayscale or black-and-white with the Print Preview dialog box.
Use the -cmyk option with the print function. This example prints the current figure in CMYK using a PostScript Level II color printer driver.
print -dpsc2 -cmyk
User interface controls are objects that you create and add to a figure. For example, you can add a button to a figure that, when clicked, conveniently runs another M-file. By default, user interface controls are included in your printed or exported figure. This section shows how to exclude them.
Open the Print Preview dialog box by selecting Print Preview from the figure window's File menu, and then select the Advanced tab.
Use the -noui switch. This example specifies a color PostScript driver and excludes UI controls.
print -dpsc -noui
This example exports the current figure to a color EPS file and excludes UI controls.
print -depsc -noui myfile.eps
In most cases, MATLAB crops the background tightly around the objects in the figure. Depending on the printer driver or file format you use, you might be able to produce uncropped output. An uncropped figure has increased background area and is often desirable for figures that contain UI controls.
The setting you make changes the PostScript BoundingBox property saved with the figure.
Use the -loose option with the print function. On Windows platforms, the uncropped option is only available if you print to a file.
This example exports the current figure, uncropped, to an EPS file.
print -deps -loose myfile.eps
![]() | Examples of Printing and Exporting | Choosing a Graphics Format | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |