grid
, but imported to R via
gridSVGCoords
.
viewportConvertX(vpname, x, from, to = "svg")
viewportConvertY(vpname, x, from, to = "svg")
viewportConvertPos(vpname, x, y, from, to = "svg")
viewportConvertWidth(vpname, x, from, to)
viewportConvertHeight(vpname, x, from, to)
viewportConvertDim(vpname, w, h, from, to)
from
units.
x
is.
x
is being converted to.
x
and y
for
viewportConvertPos()
, or a list with components w
and h
for viewportConvertDim()
.In the case of the viewportConvertX
and viewportConvertY
functions, we always return a value that is in terms of SVG pixels.
grid
has conversion functions available, it
only converts units relative to the current viewport. After writing
out to SVG, we no longer have actual grid viewports to convert units
within. These functions are designed so that once coordinate information is
loaded into gridSVG
via gridSVGCoords
, we can
translate units within each of these viewports. Note: this requires
that a gridSVG
plot has had viewport information exported.
These functions can be used in much the same way as grid
's unit
conversion functions, the only difference being that we have a new
unit, svg
, which represents the size of a unit in SVG pixels.
The viewportConvertPos()
and viewportConvertDim()
functions are for use with a viewport
that has a non-zero rotation (both viewportConvertX()
and
viewportConvertY()
will fail in that situation
and viewportConvertWidth()
and viewportConvertHeight()
will give a not very useful answer).