This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Align figure windows


iptwindowalign(fixed_fig, fixed_fig_edge, moving_fig, moving_fig_edge)


iptwindowalign(fixed_fig, fixed_fig_edge, moving_fig, moving_fig_edge) moves the figure moving_fig to align it with the figure fixed_fig. moving_fig and fixed_fig are handles to figure objects.

fixed_fig_edge and moving_fig_edge describe the alignment of the figures in relation to their edges and can take any of the following values: 'left', 'right', 'hcenter', 'top', 'bottom', or 'vcenter'. 'hcenter' means center horizontally and 'vcenter' means center vertically. The following figure shows these alignments.


The two specified locations must be consistent in terms of their direction. For example, you cannot specify 'left' for fixed_fig_edge and 'bottom' for moving_fig_edge.

iptwindowalign constrains the position adjustment of moving_fig to keep it entirely visible on the screen.

iptwindowalign has no effect if either figure window is docked.


To illustrate some possible figure window alignments, first create two figures: fig1 and fig2. Initially, fig2 overlays fig1 on the screen.

fig1 = figure;
fig2 = figure;

Use iptwindowalign to move fig2 so its left edge is aligned with the right edge of fig1.


Now move fig2 so its top edge is aligned with the bottom edge of fig1.

iptwindowalign(fig1, 'bottom', fig2, 'top');

Now move fig2 so the two figures are centered horizontally.

iptwindowalign(fig1, 'hcenter', fig2, 'hcenter');

See Also

Introduced before R2006a