Description Usage Arguments Details Value Examples
Convert XY in a Parent Viewport
1 | getXY_in_parent_vp(u, vp_name = "ROOT")
|
u |
A list of two units which correspond to x and y. |
vp_name |
The name of the parent viewport. |
It converts a coordinate measured in current viewport to the coordinate in a parent viewport.
In the conversion, all units are recalculated as absolute units, so if you change the size of the interactive graphic window, you need to rerun the function.
A list of two units.
1 2 3 4 5 6 7 8 9 | grid.newpage()
pushViewport(viewport(x = 0.5, y = 0.5, width = 0.5, height = 0.5, just = c("left", "bottom")))
grid.rect()
grid.points(x = unit(2, "cm"), y = unit(2, "cm"), pch = 1)
u = list(x = unit(2, "cm"), y = unit(2, "cm"))
u2 = getXY_in_parent_vp(u)
popViewport()
grid.rect(gp = gpar(col = "red"))
grid.points(x = u2$x, u2$y, pch = 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.