Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getXY_in_parent_vp

Convert XY in a Parent Viewport


Description

Convert XY in a Parent Viewport

Usage

getXY_in_parent_vp(u, vp_name = "ROOT")

Arguments

u

A list of two units which correspond to x and y.

vp_name

The name of the parent viewport.

Details

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.

Value

A list of two units.

Examples

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)

ComplexHeatmap

Make Complex Heatmaps

v2.6.2
MIT + file LICENSE
Authors
Zuguang Gu
Initial release
2020-11-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.