Filled area 2-D plot

`area(Y)`

area(X,Y)

area(...,basevalue)

area(...,'* PropertyName*',PropertyValue,...)

area(ax,...)

h = area(...)

An area graph displays elements in `Y`

as one
or more curves and fills the area beneath each curve. When `Y`

is
a matrix, the curves are stacked showing the relative contribution
of each row element to the total height of the curve at each x interval.

`area(Y)`

plots the vector `Y`

or
plots each column in matrix `Y`

as a separate curve
and stacks the curves. The *x*-axis automatically
scales to `1:size(Y,1)`

. The values in `Y`

can
be numeric or duration values.

`area(X,Y)`

For vectors `X`

and `Y`

, `area(X,Y)`

is
the same as `plot(X,Y)`

except that the area between `0`

and `Y`

is
filled. When `Y`

is a matrix, `area(X,Y)`

plots
the columns of `Y`

as filled areas. For each `X`

,
the net result is the sum of corresponding values from the rows of `Y`

.

If `X`

is a vector, `length(X)`

must
equal `length(Y)`

. If `X`

is a matrix, `size(X)`

must
equal `size(Y)`

. The values in `X`

can
be numeric or datetime or duration values.

`area(...,basevalue)`

specifies
the base value for the area fill. The default `basevalue`

is `0`

.
Specify the base value as a numeric value.

`area(...,'`

specifies
property name and property value pairs for the patch graphics object
created by * PropertyName*',PropertyValue,...)

`area`

. `area(ax,...)`

plots into
the axes `ax`

instead of into the current axes (`gca`

).

`h = area(...)`

returns `area`

graphics
objects.

Creating an area graph of an *m*-by-*n* matrix
creates *n* area objects (that is, one per column),
whereas a 1-by-*n* vector creates one area object.

Some area object properties that you set on an individual area object set the values for all area objects in the graph. See Area Properties for information on specific properties.

Was this topic helpful?