# `plot`::`Rectangle`

Rectangles in 2D

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```plot::Rectangle(`xmin .. xmax`, `ymin .. ymax`, <`a = amin .. amax`>, `options`)
```

## Description

```plot::Rectangle( `x_{min}`..`x_{max}` , `y_{min}`..`y_{max}` )``` generates the 2D rectangle with the corners ```(xmin, ymin)```, ```(xmin, ymax)```, ```(xmax, ymin)```, ```(xmax, ymax)```.

`plot::Rectangle` creates a 2D rectangle with edges parallel to the coordinate axes.

With `Filled` = `FALSE`, the rectangle consists only of its edges. With `Filled` = `TRUE`, it is a filled area.

The lines can be set as desired with `LineStyle`, `LineWidth`, and `LineColor`. Cf. Example 1.

With `LinesVisible = FALSE`, the edges are rendered invisible.

For filled rectangles, a `FillColor` and a `FillPattern` can be selected. Cf. Example 2.

## Attributes

AttributePurposeDefault Value
`AffectViewingBox`influence of objects on the `ViewingBox` of a scene`TRUE`
`AntiAliased`antialiased lines and points?`FALSE`
`Color`the main color`RGB::Blue`
`Filled`filled or transparent areas and surfaces`FALSE`
`FillColor`color of areas and surfaces`RGB::Red`
`FillPattern`type of area filling`DiagonalLines`
`Frames`the number of frames in an animation`50`
`Legend`makes a legend entry
`LegendText`short explanatory text for legend
`LegendEntry`add this object to the legend?`FALSE`
`LineColor`color of lines`RGB::Blue`
`LineWidth`width of lines`0.35`
`LineStyle`solid, dashed or dotted lines?`Solid`
`LinesVisible`visibility of lines`TRUE`
`LineColorDirection`the direction of color transitions on lines[`0`, `1`]
`LineColorDirectionX`x-component of the direction of color transitions on lines`0`
`LineColorDirectionY`y-component of the direction of color transitions on lines`1`
`Name`the name of a plot object (for browser and legend)
`ParameterEnd`end value of the animation parameter
`ParameterName`name of the animation parameter
`ParameterBegin`initial value of the animation parameter
`ParameterRange`range of the animation parameter
`TimeEnd`end time of the animation`10.0`
`TimeBegin`start time of the animation`0.0`
`TimeRange`the real time span of an animation`0.0` .. `10.0`
`Title`object title
`TitleFont`font of object titles[`" sans-serif "`, `11`]
`TitlePosition`position of object titles
`TitleAlignment`horizontal alignment of titles w.r.t. their coordinates`Center`
`TitlePositionX`position of object titles, x component
`TitlePositionY`position of object titles, y component
`Visible`visibility`TRUE`
`VisibleAfter`object visible after this time value
`VisibleBefore`object visible until this time value
`VisibleFromTo`object visible during this time range
`VisibleAfterEnd`object visible after its animation time ended?`TRUE`
`VisibleBeforeBegin`object visible before its animation time starts?`TRUE`
`XMax`final value of parameter “x”`1`
`XMin`initial value of parameter “x”`-1`
`XRange`range of parameter “x”`-1` .. `1`
`YMax`final value of parameter “y”`1`
`YMin`initial value of parameter “y”`-1`
`YRange`range of parameter “y”`-1` .. `1`

## Examples

### Example 1

We plot two rectangles:

```plot(plot::Rectangle(-2..2, -2..2, Filled = TRUE, FillColor = RGB::Red), plot::Rectangle(1..5, 1..5, Filled = FALSE, LineColor = RGB::Black, LineStyle = Dashed))```

### Example 2

We plot rectangles with different fill patterns (`FillPattern`):

```plot(plot::Rectangle(0..1, 2..3, Filled = TRUE, FillPattern = Solid, FillColor = RGB::Red), plot::Rectangle(1..2, 2..3, Filled = TRUE, FillPattern = CrossedLines, FillColor = RGB::Green), plot::Rectangle(2..3, 2..3, Filled = TRUE, FillPattern = XCrossedLines, FillColor = RGB::Blue), plot::Rectangle(0..1, 1..2, Filled = TRUE, FillPattern = HorizontalLines, FillColor = RGB::Orange), plot::Rectangle(1..2, 1..2, Filled = TRUE, FillPattern = VerticalLines, FillColor = RGB::Violet), plot::Rectangle(0..1, 0..1, Filled = TRUE, FillPattern = DiagonalLines, FillColor = RGB::Brown), plot::Rectangle(1..2, 0..1, Filled = TRUE, FillPattern = FDiagonalLines, FillColor = RGB::Cyan))```

## Parameters

 `xmin .. xmax` The left and right border of the rectangle: real numerical values or arithmetical expressions of the animation parameter `a`. `xmin` .. `xmax` is equivalent to the attributes `XRange`, `XMin`, `XMax`. `ymin .. ymax` The lower and upper border of the rectangle: real numerical values or arithmetical expressions of the animation parameter `a`. `ymin` .. `ymax` is equivalent to the attributes `YRange`, `YMin`, `YMax`. `a` Animation parameter, specified as `a```` = amin..amax```, where `amin` is the initial parameter value, and `amax` is the final parameter value.

### MuPAD Graphical Primitives

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos