| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
| On this page… |
|---|
Printing a Figure at Screen Size Printing with a Specific Paper Size Exporting in a Specific Graphics Format |
By default, your figure prints at 8-by-6 inches. This size includes the area delimited by the background. This example shows how to print or export your figure the same size it is displayed on your screen.
Resize your figure window to the size you want it to be when printed.
Select Print Preview from the figure window's File menu, and select the Layout tab.
In the Placement panel, select Auto (Actual Size, Centered).
Set the PaperPositionMode property to auto before printing the figure.
set(gcf, 'PaperPositionMode', 'auto'); print
If later you want to print the figure at its original size, set PaperPositionMode back to 'manual'.
The MATLAB default paper size is 8.5-by-11 inches. This example shows how to change the paper size to 8.5-by-14 inches by selecting a paper type (Legal).
Select Print Preview from the figure window's File menu, and select the Layout tab.
Select the Legal paper type from the list in the Paper panel. The Width and Height fields update to 8.5 and 14, respectively.
Set the PaperUnits property to inches and the PaperType property to Legal.
set(gcf, 'PaperUnits', 'inches'); set(gcf, 'PaperType', 'Legal');
Alternatively, you can set the PaperSize property to the size of the paper, in the specified units.
set(gcf, 'PaperUnits', 'inches'); set(gcf, 'PaperSize', [8.5 14]);
This example sets the size of a figure to 5.5-by-3 inches and centers it on the paper.
Select Print Preview from the figure window's File menu, and select the Layout tab.
Click Print to open the Print dialog box and print the figure.
Start by setting PaperUnits to inches.
set(gcf, 'PaperUnits', 'inches')
Use PaperSize to return the size of the current paper.
papersize = get(gcf, 'PaperSize')
papersize =
8.5000 11.0000Initialize variables to the desired width and height of the figure.
width = 5.5; % Initialize a variable for width. height = 3; % Initialize a variable for height.
Calculate a left margin that centers the figure horizontally on the paper. Use the first element of papersize (width of paper) for the calculation.
left = (papersize(1)- width)/2
left =
1.5000Calculate a bottom margin that centers the figure vertically on the paper. Use the second element of papersize (height of paper) for the calculation.
bottom = (papersize(2)- height)/2
bottom =
4Set the figure size and print.
myfiguresize = [left, bottom, width, height]; set(gcf, 'PaperPosition', myfiguresize); print
Export a figure to a graphics-format file when you want to import it at a later time into another application such as a word processor.
Use the Save in field to navigate to the folder in which you want to save your file.
Enter a filename in the File name field. An appropriate file extension, based on the format you chose, is displayed.
From the command line, you must specify the graphics format as an option. See the print reference page for a complete list of graphics formats and their corresponding option strings.
This example exports a figure to an EPS color file, myfigure.eps, in your current folder.
print -depsc myfigure
This example exports Figure No. 2 at a resolution of 300 dpi to a 24-bit JPEG file, myfigure.jpg.
print -djpeg -f2 -r300 myfigure
This example exports a figure at screen size to a 24-bit TIFF file, myfigure.tif.
set(gcf, 'PaperPositionMode', 'auto') % Use screen size print -dtiff myfigure
Use the print function to export a figure in EPS format with a TIFF preview. When you import the figure, the application can display the TIFF preview in the source document. The preview is color if the exported figure is color, and black and white if the exported figure is black and white.
This example exports a figure to an EPS color format file, myfigure.eps, and includes a color TIFF preview.
print -depsc -tiff myfigure
This example exports a figure to an EPS black-and-white format file, myfigure.eps, and includes a black-and-white TIFF preview.
print -deps -tiff myfigure
Export a figure to the clipboard in graphics format when you want to paste it into another Windows or Macintosh application such as a word processor.
This example exports a figure to the clipboard in enhanced metafile (EMF) format. Figure settings are chosen that would make the exported figure suitable for use in a Microsoft Word or PowerPoint slide. Changing the settings modifies the figure displayed on the screen.
Create a figure containing text. You can use the following code.
x = -pi:0.01:pi;
h = plot(x, sin(x));
title('Sine Plot');
Select Preferences from the File menu of either the figure or main desktop window. Then select Figure Copy Template from the Preferences dialog box.
In the Figure Copy Template Preferences panel, click the PowerPoint button. The suggested settings for PowerPoint are added to the template.

In the Uicontrols and axes panel, select Keep axes limits and tick spacing to prevent tick marks and limits from possibly being rescaled when you export.
Click Apply to Figure. The changes appear in the figure window.
If you don't like the way your figure looks with the new settings, restore it to its original settings by clicking the Restore Figure button.
In the left pane of the Preferences dialog box, expand the Figure Copy Template topic. Select Copy Options.
In the Copy Options panel, select Metafile to export the figure in EMF format.
Check that Transparent background is selected. This choice makes the figure background transparent and allows the slide background to frame the axes part of the figure.
Clear the Match figure screen size check box so that you can use your own figure size settings.
Select the Size properties, and set Width to 6 and Height to 4.5. Make sure that Units are set to inches.
Select Copy Figure from the Edit menu. Your figure is now exported to the clipboard and can be pasted into another Windows application, such as PowerPoint.
Use the print function and one of two clipboard formats (-dmeta, -dbitmap) to export a figure to the clipboard. Do not specify a filename.
This example exports a figure to the clipboard in enhanced metafile (EMF) format.
print -dmeta
This example exports a figure to the clipboard in bitmap (BMP) 8-bit color format.
print -dbitmap
![]() | How to Print or Export | Changing a Figure's Settings | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |