rectangle
Create rectangle with sharp or curved corners
Syntax
Description
rectangle('Position',
creates
a rectangle in 2-D coordinates. Specify pos
)pos
as
a four-element vector of the form [x
y w h]
in data units. The x
and y
elements
determine the location and the w
and h
elements
determine the size. The function plots into the current axes without
clearing existing content from the axes.
rectangle('Position',
adds
curvature to the sides of the rectangle. For different curvatures
along the horizontal and vertical sides, specify pos
,'Curvature',cur
)cur
as
a two-element vector of the form [horizontal vertical]
.
For the same length of curvature along all sides, specify cur
as
a scalar value. Specify values between 0 (no curvature) and 1 (maximum
curvature). Use [1 1]
to create an ellipse or circle.
rectangle(___,
specifies
rectangle properties using one or more name-value pair arguments.
For example, Name,Value
)'FaceColor','red'
specifies a red
fill color. You can specify rectangle properties with any of the input
argument combinations in the previous syntaxes.
rectangle(
creates
the rectangle in the axes specified by ax
,___)ax
instead
of in the current axes (gca
). The option ax
can
precede any of the input argument combinations in the previous syntaxes.
returns
the rectangle object. Use r
= rectangle(___)r
to modify properties
of the rectangle after it is created. For a list of properties, see Rectangle Properties. You can return
an output argument with any of the previous syntaxes.
Examples
Input Arguments
Version History
Introduced before R2006a