Previous: Two-dimensional Function Plotting, Up: Two-Dimensional Plots


15.2.1.3 Two-dimensional Geometric Shapes

— Function File: rectangle ()
— Function File: rectangle (..., "Position", pos)
— Function File: rectangle (..., "Curvature", curv)
— Function File: rectangle (..., "EdgeColor", ec)
— Function File: rectangle (..., "FaceColor", fc)
— Function File: h = rectangle (...)

Draw 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

Other properties are passed to the underlying patch command.

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

See also: patch.