Graphics    

Setting the Figure Size and Position

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:

Using the Graphical User Interface

Select Page Setup from the figure window's File menu to open the Page Setup dialog box. Click the Size and Position 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 graphical user interface at the right to drag the borders and location of the "sample" figure with your mouse.



Settings you can change in the Size and Position window are as follows:

Mode.   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 Size and Position window.

The next two panels are enabled only when you select the Use manual size and position mode.

Manual size and position.   Enter the measurements and units for the size and position of the figure.

Graphical User Interface.   Use the "Sample" figure at the right of the dialog box to move and resize your MATLAB figure interactively.

To set the width and height interactively, use the mouse to drag the edges of the "Sample" figure to the desired size.

To set the margins of the figure (offsets from the left and top edges of the paper), drag the entire "Sample" figure to a new position with the mouse.

If you want the figure resized to fill the paper, click Fill page. Note that Fill page may alter the aspect ratio of your image. To get the maximum figure size without altering the aspect ratio, select Fix aspect ratio.

Using MATLAB Commands

To print your figure with a specific size or position, make sure that 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

where

The MATLAB default values for PaperPosition are

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.


  Selecting the Figure Setting the Paper Size or Type