subplot

Purpose

Create and control tiled axes.

Synopsis

h = subplot(m,n,p)
subplot(m,n,p)
subplot(h)

Description

h = subplot(m,n,p) breaks the figure window into an m-by-n matrix of small rectangular panes, creates an axes in the p-th pane, makes it current, and returns the handle to this new axes. The axes are counted along the top row of the figure window, then the second row, etc.

subplot(m,n,p), if an axes already exists at a specified location, makes it current.

subplot(h), where h is an axes handle, is another way of making an axes current for subsequent plotting commands.

If a subplot specification causes an new axes to overlap an existing axes, the existing axes is deleted. For example, the statement subplot(1,1,1) deletes all existing smaller axes in the figure window and creates a new full-figure axes.

Use clf or subplot(1,1,1) to delete all axes and return to the default subplot(1,1,1) configuration.

Examples

To plot income on the top half of the screen and outgo on the bottom half,

income = [3.2  4.1  5.0]
outgo = [3.0  3.2  3.35]
subplot(2,1,1), plot(income)
subplot(2,1,2), plot(outgo)

See Also

axes, cla, clf, figure, gca

(c) Copyright 1994 by The MathWorks, Inc.