Learn R Programming

Gmisc (version 1.8.1)

boxGrob: Create a box with text

Description

Creates a grob box with text inside it.

Usage

boxGrob(label, y = unit(0.5, "npc"), x = unit(0.5, "npc"), width,
  height, just = "center", bjust = "center",
  txt_gp = getOption("boxGrobTxt", default = gpar(color = "black")),
  box_gp = getOption("boxGrob", gpar(fill = "#D8F0D1")), name = NULL)

# S3 method for box widthDetails(x)

# S3 method for box heightDetails(x)

# S3 method for box print(x, ...)

# S3 method for box plot(x, ...)

Arguments

label

The label to print - should be a number, text or expression.

y

The y position to put the box at. Can be either in npc (i.e. 0-1) or a unit.

x

The x position to put the box at. Can be either in npc (i.e. 0-1) or a unit.

width

The box autosizes but you can force by specifying the width

height

The box autosizes but you can force by specifying the height

just

The justification for the text: left, center or right.

bjust

The justification for the box: left, center, right, top or bottom. See the just option for the viewport

txt_gp

The gpar style to apply to the text. Set boxGrobTxt option if you want to customize all the boxes at once.

box_gp

The gpar style to apply to the box. Set boxGrob option if you want to customize all the boxes at once.

name

a character identifier for the grob. Used to find the grob on the display list and/or as a child of another grob.

...

Passed to grid.draw

Value

A grob

See Also

Other box-functions: boxPropGrob, connectGrob

Examples

Run this code
# NOT RUN {
library(grid)
grid.newpage()
boxGrob("My box")
# }

Run the code above in your browser using DataLab