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.
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
)
A box grob
The label to print - should be a number, text or expression.
The label for the left area
The label for the right area
The proportion to split along
The y position to put the box at. Can be either in npc
(i.e. 0-1) or a unit
.
The x position to put the box at. Can be either in npc
(i.e. 0-1) or a unit
.
The box automatically adapts the size but you can force by specifying the width
The box automatically adapts the size but you can force by specifying the height
The justification for the text: left, center or right.
The justification for the box: left, center, right, top or bottom.
See the just
option for the viewport
The gpar
style to apply to the text. Set boxPropGrobTxt
option
if you want to customize all the boxes at once.
The gpar
style to apply to the left text. Set
boxPropGrobLeftTxt
option if you want to customize all the boxes at once.
The gpar
style to apply to the right text. Set
boxPropGrobRightTxt
option if you want to customize all the boxes at once.
The gpar
style to apply to the left box. Set
boxPropGrobLeft
option if you want to customize all the boxes at once.
The gpar
style to apply to the right box. Set
boxPropGrobRight
option if you want to customize all the boxes at once.
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.
a character identifier for the grob
. Used to find the grob
on the display
list and/or as a child of another grob.
Other flowchart components:
align
,
boxGrob()
,
connectGrob()
,
coords()
,
distance()
,
moveBox()
,
spread
library(grid)
grid.newpage()
boxPropGrob("Main label", "Left text", "Right text", prop = .3)
Run the code above in your browser using DataLab