Previous: , Up: Two-Dimensional Plots   [Contents][Index]


15.2.1.3 Two-dimensional Geometric Shapes

rectangle ()
rectangle (…, "Position", pos)
rectangle (…, "Curvature", curv)
rectangle (…, "EdgeColor", ec)
rectangle (…, "FaceColor", fc)
rectangle (hax, …)
h = rectangle (…)

Draw a rectangular patch defined by pos and curv.

The variable pos(1:2) defines the lower left-hand corner of the patch and pos(3:4) defines its width and height. By default, the value of pos is [0, 0, 1, 1].

The variable curv defines the curvature of the sides of the rectangle and may be a scalar or two-element vector with values between 0 and 1. A value of 0 represents no curvature of the side, whereas a value of 1 means that the side is entirely curved into the arc of a circle. If curv is a two-element vector, then the first element is the curvature along the x-axis of the patch and the second along y-axis.

If curv is a scalar, it represents the curvature of the shorter of the two sides of the rectangle and the curvature of the other side is defined by

min (pos(1:2)) / max (pos(1:2)) * curv

Additional property/value pairs are passed to the underlying patch command. The full list of properties is documented at Patch Properties.

If the first argument hax is an axes handle, then plot into this axes, rather than the current axes returned by gca.

The optional return value h is a graphics handle to the created rectangle object.

See also: patch, line, cylinder, ellipsoid, sphere.


Previous: , Up: Two-Dimensional Plots   [Contents][Index]