Filled area 2-D plot
area(
plots the
values in X
,Y
)Y
against the x-coordinates
X
. The function then fills the areas between the curves based on the
shape of Y
:
If Y
is a vector, the plot contains one curve.
area
fills the area between the curve and the horizontal
axis.
If Y
is a matrix, the plot contains one curve for each column
in Y
. area
fills the areas between the curves
and stacks them, showing the relative contribution of each row element to the total
height at each x-coordinate.
area(
plots Y
)Y
against an
implicit set of x-coordinates and fills the areas between the curves.
If Y
is a vector, the x-coordinates range
from 1 to length(Y)
.
If Y
is a matrix, the x-coordinates range
from 1 to the number of rows in Y
.
area(___,
specifies the
baseline value for the area plot. basevalue
)basevalue
corresponds to a horizontal
baseline. area
fills the area confined between the curves and this line.
Specify basevalue
as the last argument in any of the previous
syntaxes.
area(___,
modifies the
properties of the area plot using one or more name-value pair arguments. The properties
apply to all of the displayed areas. For example, Name,Value
)'LineStyle','--'
specifies a dashed line style for the plot. Specify the name-value pairs after all of the
arguments in any of the previous syntaxes. For a list of properties, see Area Properties.
area(
displays the area
plot in the target axes. Specify the axes as the first argument in any of the previous
syntaxes.ax
,___)
a = area(___)
returns one or more
Area
objects. The number of objects is equal to the number of plotted
areas. Use a
to modify properties of the areas after creating them. For a
list of properties, see Area Properties.
area
uses colors based on the ColorOrder
property of the
axes. It cycles through all colors, and then it repeats the cycle if you plot more filled
regions than there are colors.
Starting in R2019b, you can change the colors after plotting by setting the
ColorOrder
property on the axes. You can also call the colororder
function to change the color order for all the axes in the figure.