coords: Importing an external coordinate system

Coordinate System Import/ExportR Documentation

Importing an external coordinate system


This function is both a getter and a setter function for coordinate information imported from a plot unknown to the current R session.


gridSVGCoords(newcoords = NULL)



A named list (names are viewport names) of coordinate information, produced by grid.export.


In order to translate between SVG coordinates and the coordinate system that grid understands, we first need to import the coordinate information exported from grid.export. We can then take the JSON representation of this coordinate information and import it as a named list via fromJSON. This can then initialise a coordinate system by passing that named list into gridSVGCoords.

We can supply new definitions of a viewport's coordinate system by simply passing in an appropriate list with information for that viewport.

All viewport coordinate system information can be wiped if a single NA value is passed in.


If newcoords is NULL, then we get back a named list representing coordinate system information.

If we pass the named list representing a coordinate system into the function, we get no output. We also get no output if we pass in a single NA value.


Simon Potter

gridSVG documentation built on March 31, 2023, 11:17 p.m.