Graphics Previous page   Next Page

Positioning Figures

The figure Position property controls the size and location of the figure window on the root screen. At startup, MATLAB determines the size of your computer screen and defines a default value for Position. This default creates figures about one-quarter of the screen's size and places them centered left to right and in the top half of the screen.

The Position Vector

MATLAB defines the figure Position property as a vector.

left and bottom define the position of the first addressable pixel in the lower left corner of the window, specified with respect to the lower left corner of the screen. width and height define the size of the interior of the window (i.e., exclusive of the window border).

MATLAB does not measure the window border when placing the figure; the Position property defines only the internal active area of the figure window.

Because figures are windows under the control of your computer's windowing system, you can move and resize figures as you would any other windows. MATLAB automatically updates the Position property to the new values.

Units

The figure's Units property determines the units of the values used to specify the position on the screen. Possible values for the Units property are

with pixels being the default. These choices allow you to specify the figure size and location in absolute units (such as inches) if you want the window always to be a certain size, or in units relative to the screen size (such as pixels).

Characters are units that enable you to define the location and size of the figure in units that are based on the size of the default system font. See Example -- Using Figure Panels for an example that uses character units.

Determining Screen Size

Whatever units you use, it is important to know the extent of the screen in those units. You can obtain this information from the root ScreenSize property. For example,

In this case, the screen is 1152 by 900 pixels. MATLAB returns the ScreenSize in the units determined by the root Units property. For example,

normalizes the values returned by ScreenSize.

Defining the figure Position in terms of the ScreenSize in normalized units makes the specification independent of variations in screen size. This is useful if you are writing an M-file that is to be used on different computer systems.


Previous page  Docking Figures in the Desktop Example -- Specifying Figure Position Next page

© 1994-2005 The MathWorks, Inc.