MATLAB Functions | Help Desk |
subplot
Create and control multiple Axessubplot(m,
n,
p) subplot(h) subplot('Position',[left bottom width height]) h = subplot(...)
subplot
divides the current Figure into rectangular panes that are numbered row-wise. Each pane contains an Axes. Subsequent plots are output to the current pane.
subplot(m,n,p)
creates an Axes in the p
-th pane of a Figure divided into an m
-by-n
matrix of rectangular panes. The new Axes becomes the current Axes.
subplot(h)
makes the Axeswith handle h
current for subsequent plotting commands.
subplot('Position',[left bottom width height])
creates an Axes at the position specified by a four-element vector. left
, bottom
, width
, and height
are in normalized coordinates in the range from 0.0 to 1.0.
h = subplot(...)
returns the handle to the new Axes.
If a subplot
specification causes a new Axes to overlap an existing Axes, subplot
deletes the existing Axes. subplot(1,1,1)
or clf
deletes all Axes objects and returns to the default subplot(1,1,1)
configuration.
To plot income
in the top half of a Figure and outgo
in the bottom half,
income = [3.2 4.1 5.0 5.6]; outgo = [2.5 4.0 3.35 4.9]; subplot(2,
1,
1); plot(income) subplot(2,
1,
2); plot(outgo)
axes
, cla
, clf
, figure
, gca