The R Project SVN R

Rev

Rev 25323 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25323 Rev 26693
Line 31... Line 31...
31
    these calculations if the size of your device is fixed.} 
31
    these calculations if the size of your device is fixed.} 
32
\seealso{ \code{\link{grid.convert}}, \code{\link{unit}} }
32
\seealso{ \code{\link{grid.convert}}, \code{\link{unit}} }
33
 
33
 
34
\examples{
34
\examples{
35
grid.newpage()
35
grid.newpage()
36
push.viewport(viewport(width=unit(.5, "npc"),
36
pushViewport(viewport(width=unit(.5, "npc"),
37
                       height=unit(.5, "npc")))
37
                       height=unit(.5, "npc")))
38
grid.rect()
38
grid.rect()
39
w <- convertNative(unit(1, "inches"))
39
w <- convertNative(unit(1, "inches"))
40
h <- convertNative(unit(1, "inches"), "y")
40
h <- convertNative(unit(1, "inches"), "y")
41
# This rectangle starts off life as 1in square, but if you
41
# This rectangle starts off life as 1in square, but if you
42
# resize the device it will no longer be 1in square
42
# resize the device it will no longer be 1in square
43
grid.rect(width=unit(w, "native"), height=unit(h, "native"),
43
grid.rect(width=unit(w, "native"), height=unit(h, "native"),
44
          gp=gpar(col="red"))
44
          gp=gpar(col="red"))
45
pop.viewport(1)
45
popViewport(1)
46
 
46
 
47
# How to use grid.convert(), etc instead
47
# How to use grid.convert(), etc instead
48
convertNative(unit(1, "inches")) ==
48
convertNative(unit(1, "inches")) ==
49
  grid.convertX(unit(1, "inches"), "native", valueOnly=TRUE)
49
  grid.convertX(unit(1, "inches"), "native", valueOnly=TRUE)
50
convertNative(unit(1, "inches"), "y", "dimension") ==
50
convertNative(unit(1, "inches"), "y", "dimension") ==