| Graphics | ![]() |
Printing to a Printer, Setting the Size of and Centering a Figure
This example sets the size of a figure to 5.5-by-3 inches and centers it on the paper:
From the Windows and UNIX Menus
5.5 in the Width field and 3 in the Height field. (You can type these values or click the arrows to select the new size.)
From the Command Line
PaperUnits to inches.
set(gcf,'PaperUnits','inches')
PaperSize to return the size of the current paper.
papersize = get(gcf,'PaperSize') papersize = 8.5000 11.0000
width = 5.5; % Initialize a variable for width. height = 3; % Initialize a varible for height.
PaperSize (width of paper) for the calculation.
left = (PaperSize(1)- width)/2 left = 1.5000
PaperSize (height of paper) for the calculation.
bottom = (PaperSize(2)- height)/2 bottom = 4
myfiguresize = [left, bottom, width, height]; set(gcf, 'PaperPosition', myfiguresize); print
| Printing to a Printer, Setting the Paper Size | Printing to a Nondefault Printer | ![]() |