These functions create and draw rectangles.
grid.rect(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
width = unit(1, "npc"), height = unit(1, "npc"),
just = "centre", hjust = NULL, vjust = NULL,
default.units = "npc", name = NULL,
gp=gpar(), draw = TRUE, vp = NULL)
rectGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
width = unit(1, "npc"), height = unit(1, "npc"),
just = "centre", hjust = NULL, vjust = NULL,
default.units = "npc", name = NULL,
gp=gpar(), vp = NULL)
A numeric vector or unit object specifying x-location.
A numeric vector or unit object specifying y-location.
A numeric vector or unit object specifying width.
A numeric vector or unit object specifying height.
The justification of the rectangle
relative to its (x, y) location. If there are two values, the first
value specifies horizontal justification and the second value specifies
vertical justification. Possible string values are: "left"
,
"right"
, "centre"
, "center"
, "bottom"
,
and "top"
. For numeric values, 0 means left alignment
and 1 means right alignment.
A numeric vector specifying horizontal justification.
If specified, overrides the just
setting.
A numeric vector specifying vertical justification.
If specified, overrides the just
setting.
A string indicating the default units to use
if x
, y
, width
, or height
are only given as numeric vectors.
A character identifier.
An object of class gpar
, typically the output
from a call to the function gpar
. This is basically
a list of graphical parameter settings.
A logical value indicating whether graphics output should be produced.
A Grid viewport object (or NULL).
A rect grob. grid.rect
returns the value invisibly.
Both functions create a rect grob (a graphical object describing
rectangles), but only grid.rect
draws the rectangles (and then only if draw
is TRUE
).