[R] "user units" in plotrix
Murat Tasan
mmuurr at gmail.com
Sun Jan 20 22:59:31 CET 2013
hi all - i'm having some difficulty figuring out how to convert
between "user units" (which i can't find a definition for in the
plotrix package) and either (a) device units (e.g. inches with PDFs)
or (b) user coordinates along any particular axis.
as an example, suppose i set up a PDF device with inches, the device
has both outer and inner magins, and the plot region has drastically
different x and y coordinate ranges (e.g. xlim = c(0, 1), ylim = c(0,
SOME_VERY_LARGE_NUMBER)).
now i'd like to draw.circle(...) but i can't figure out what units the
radius argument takes.
"user units" doesn't appear to be inches in this case, and it it
corresponds to user coordinates, i don't know which axis' scaling is
to be used as the reference.
ideally, one would be able to specify the radius in user coordinates
while specifying _which_ axis to use as the standard (e.g. an axis =
"y" or axis = "x" argument).
getFigCtr(...) can help in figuring this out, but its argument takes
the relative position of the "figure" region, rather than the "plot"
region, which is more apt for properly placing shapes.
i know the grid package has extensive unit conversion code, but i'm
trying to update a series of figures using only base graphics...
i can't seem to find a rigorous definition of "user units" anywhere in
the plotrix package.
anyone know of where i can find this info?
cheers,
-m
More information about the R-help
mailing list