This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / Built-in Functions / Graphics and Sound / Graphics Primitives  /
Rectangle

  • Rectangle[ xmin , ymin , xmax , ymax ] is a two-dimensional graphics primitive that represents a filled rectangle, oriented parallel to the axes.
  • Rectangle[ xmin , ymin , xmax , ymax , graphics ] gives a rectangle filled with the specified graphics.
  • Scaled and Offset can be used to specify the coordinates for the rectangle.
  • Rectangle[Scaled[ xmin , ymin ], Scaled[ xmax , ymax ]] yields a rectangle with corners specified by scaled coordinates.
  • Any combination of original coordinates, as well as Scaled and Offset, can be used to specify the corners of the rectangle.
  • Rectangle[ xmin , ymin , xmax , ymax ] is equivalent to a suitable Polygon with four corners.
  • You can use graphics directives such as GrayLevel and RGBColor to specify how Rectangle[ xmin , ymin , xmax , ymax ] should be filled.
  • In Rectangle[ xmin , ymin , xmax , ymax , graphics ], graphics can be any graphics object.
  • The rectangle is taken as the complete display area in which the graphics object is rendered.
  • When rectangles overlap, their backgrounds are effectively taken to be transparent.
  • Fonts and absolute size specifications are not affected by the size of the rectangle in which the graphics are rendered.
  • The options DisplayFunction, ColorOutput and CharacterEncoding are ignored for graphics objects given inside Rectangle.
  • See the Mathematica book: Section 2.9.2.
  • See also: Polygon, Raster, RasterArray, Cuboid, GraphicsArray.

    Further Examples

    This displays two colored rectangles in the plane.

    Evaluate the cell to see the graphic.

    In[1]:=