Learn R Programming

Gmisc (version 3.0.3)

boxPropGrob: Create a box with a color split

Description

Creates a grob box with text inside it and a color split in the horizontal axes that allow indicating different proportions. The box can also have a title that spanse the two color areas and that has its own background.

Usage

boxPropGrob(
  label,
  label_left,
  label_right,
  prop,
  y = unit(0.5, "npc"),
  x = unit(0.5, "npc"),
  width,
  height,
  just = "center",
  bjust = "center",
  txt_gp = getOption("boxPropGrobTxt", default = gpar(color = "black")),
  txt_left_gp = getOption("boxPropGrobLeftTxt", default = gpar(col = "black")),
  txt_right_gp = getOption("boxPropGrobRightTxt", default = gpar(col = "black")),
  box_left_gp = getOption("boxPropGrobLeft", default = gpar(fill = "#E6E8EF")),
  box_right_gp = getOption("boxPropGrobRight", default = gpar(fill = "#FFFDF6")),
  box_highlight_gp = getOption("boxPropGrobHighlight", default = gpar(fill = "#ffffff55",
    col = NA)),
  name = NULL
)

Value

A box grob

Arguments

label

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

label_left

The label for the left area

label_right

The label for the right area

prop

The proportion to split along

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 automatically adapts the size but you can force by specifying the width

height

The box automatically adapts the size 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 boxPropGrobTxt option if you want to customize all the boxes at once.

txt_left_gp

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

txt_right_gp

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

box_left_gp

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

box_right_gp

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

box_highlight_gp

The gpar style to apply to the background of the main label. Set boxPropGrobHighlight 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.

See Also

Other flowchart components: align, boxGrob(), connectGrob(), coords(), distance(), moveBox(), spread

Examples

Run this code
library(grid)
grid.newpage()
boxPropGrob("Main label", "Left text", "Right text", prop = .3)

Run the code above in your browser using DataLab