View source: R/boxGrobs_distance.R
distance | R Documentation |
Retrieves the distance between two boxes as absolute "mm"
units. The function also
accepts coords
objects as well as a unit
or a numeric input.
distance(
box1,
box2,
type = c("vertical", "horizontal", "euclidean"),
half = FALSE,
center = FALSE
)
## S3 method for class 'Gmisc_unit'
print(x, ...)
box1 |
The first |
box2 |
The second object to calculate the distance to. Same type as for |
type |
Whether we should retrieve the vertical, horizontal or euclidean distance |
half |
If set to true it returns half the distance. This is convenient when positioning boxes between each other. |
center |
Calculate the distance from the center of each object |
x |
A unit with from the |
... |
Passed on to print |
A unit
in "mm"
with an absolute value. The attribute
positive
indicates the direction of the value, i.e. if it is TRUE
the
distance was calculated from the first to the second, otherwise it is FALSE
.
For euclidean
distance the positive
attribute is NA
. There is also the
from
and to
attributes that has the coordinates that were used for the
calculations, for euclidean
distance this is NA
.
Other flowchart components:
align
,
boxGrob()
,
boxPropGrob()
,
connectGrob()
,
coords()
,
moveBox()
,
spread
box1 <- boxGrob("A test box", y = .8)
box2 <- boxGrob("Another test box", y = .2)
distance(box1, box2, "v")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.