Rev 26693 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{convertNative}\alias{convertNative}\title{ Convert a Unit Object to Native units }\description{\bold{This function is deprecated in grid version 0.8 and will bemade defunct in grid version 0.9}You should use the \code{grid.convert()} function or one of itsclose allies instead.This function returns a numeric vector containing the specifiedx or y locations or dimensions, converted to "user" or "data"units, relative to the current viewport.}\usage{convertNative(unit, dimension="x", type="location")}\arguments{\item{unit}{ A unit object. }\item{dimension}{ Either "x" or "y". }\item{type}{ Either "location" or "dimension". }}\value{A numeric vector.}\author{ Paul Murrell }\section{WARNING }{ If you draw objects based on output from these conversionfunctions, then resize your device, the objects will be drawnincorrectly -- the base R display list will not recalculate theseconversions. This means that you can only rely on the results ofthese calculations if the size of your device is fixed.}\seealso{ \code{\link{grid.convert}}, \code{\link{unit}} }\examples{grid.newpage()pushViewport(viewport(width=unit(.5, "npc"),height=unit(.5, "npc")))grid.rect()w <- convertNative(unit(1, "inches"))h <- convertNative(unit(1, "inches"), "y")# This rectangle starts off life as 1in square, but if you# resize the device it will no longer be 1in squaregrid.rect(width=unit(w, "native"), height=unit(h, "native"),gp=gpar(col="red"))popViewport(1)# How to use grid.convert(), etc insteadconvertNative(unit(1, "inches")) ==grid.convertX(unit(1, "inches"), "native", valueOnly=TRUE)convertNative(unit(1, "inches"), "y", "dimension") ==grid.convertHeight(unit(1, "inches"), "native", valueOnly=TRUE)}\keyword{ dplot }