moveBox: Move a boxGrob

View source: R/boxGrobs_move.R

moveBoxR Documentation

Move a boxGrob

Description

Moves a boxGrob/boxPropGrob by modifying it's viewport. This can be useful if you want to create a series of boxes whose position are relative to each other and depend on each box's width/height.

Usage

moveBox(
  element,
  x = NULL,
  y = NULL,
  space = c("absolute", "relative"),
  just = NULL
)

Arguments

element

A boxGrob/boxPropGrob object.

x

A unit element or a numeric that can be converted to a npc unit object.

y

A unit element or a numeric that can be converted to a npc unit object.

space

We can provide absolute that confers the box absolute position within the parent viewport. If relative the movement is related to the current position.

just

The justification of an argument as used by viewport some tiny differences: (1) you only want to change the justification in the vertical direction you can retain the existing justification by using NA, e.g. c(NA, 'top'), (2) if you specify only one string and that string is either top or bottom it will assume vertical justification.

Value

The element with updated

See Also

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

Examples

library(grid)
grid.newpage()

box <- boxGrob("A simple box", x = .5, y = .8)
moveBox(box, x = -.2, space = "relative")

gforge/Gmisc documentation built on Aug. 30, 2023, 7:38 a.m.