File: getXY_in_parent_vp.Rd

package info (click to toggle)
r-bioc-complexheatmap 2.14.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,632 kB
  • sloc: makefile: 5
file content (37 lines) | stat: -rw-r--r-- 971 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
\name{getXY_in_parent_vp}
\alias{getXY_in_parent_vp}
\title{
Convert XY in a Parent Viewport
}
\description{
Convert XY in a Parent Viewport
}
\usage{
getXY_in_parent_vp(u, vp_name = "ROOT")
}
\arguments{

  \item{u}{A list of two units which correspond to x and y.}
  \item{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)
}