Printing a Centered Figure
This example sets the size of a figure to 5.5-by-3 inches and centers it on the paper.
Using the Graphical User Interface
- Select Page Setup from the figure window's File menu, and select the Size and Position tab.
- Make sure Use manual size and position is selected.
5.5 in the Width field and
3 in the Height field.
- Make sure that Units field is set to
- Click Center.
- Click OK.
- Open the Print dialog box and print the figure.
Using MATLAB Commands
- Start by setting
PaperSize to return the size of the current paper.
- Initialize variables to the desired width and height of the figure.
- Calculate a left margin that centers the figure horizontally on the paper. Use the first element of
papersize (width of paper) for the calculation.
- Calculate a bottom margin that centers the figure vertically on the paper. Use the second element of
papersize (height of paper) for the calculation.
- Set the figure size and print.
myfiguresize = [left, bottom, width, height];
set(gcf, 'PaperPosition', myfiguresize);
| || Printing with a Specific Paper Size|| ||Exporting in a Specific Graphics Format |