align | R Documentation |
Aligns a set of boxGrob
/boxPropGrob
according to the first positional argument.
alignVertical(reference, ..., .position = c("center", "top", "bottom"))
alignHorizontal(
reference,
...,
.position = c("center", "left", "right"),
.sub_position = c("none", "left", "right")
)
reference |
A |
... |
A set of boxes. |
.position |
How to align the boxes, differs slightly for vertical and horizontal alignment see the accepted arguments |
.sub_position |
When the box is a |
list
with the boxes that are to be aligned
Other flowchart components:
boxGrob()
,
boxPropGrob()
,
connectGrob()
,
coords()
,
distance()
,
moveBox()
,
spread
library(grid)
grid.newpage()
box <- boxGrob("A cool\nreference\nbox",
x = .5, y = .8,
box_gp = gpar(fill = "#ADB5C7"))
another_box <- boxGrob("A horizontal box", x = .1, y = .5)
yet_another_box <- boxGrob("Another horizontal box", x = .8, y = .3)
alignedBoxes <- alignHorizontal(box,
another_box,
yet_another_box,
.position = "right")
box
for (b in alignedBoxes) {
print(b)
}
vert_box <- boxGrob("Vert",
x = .8, y = .3,
box_gp = gpar(fill = "darkgreen"),
txt_gp = gpar(col = "white"))
another_vert_box <- boxGrob("Another vertical",
x = .1, y = .5,
box_gp = gpar(fill = "darkgreen"),
txt_gp = gpar(col = "white"))
alignedBoxes <- alignVertical(box,
vert_box,
another_vert_box,
.position = "bottom")
for (b in alignedBoxes) {
print(b)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.