R: Create a grid grob representing an SVG element

grid.element {gridSVG} | R Documentation

## Create a grid grob representing an SVG element

### Description

Creates a `element.grob` object which is a grid `gTree`, representing an SVG element. Useful in conjunction with `grid.export`, to produce an SVG document with elements inserted at particular points. The element (and its children) are inserted at the point where the grob is “drawn”. Text can be inserted in a similar manner with `grid.textNode`.

### Usage

    grid.element(el, name = NULL, attrs = NULL,
                 namespace = NULL, namespaceDefinitions = NULL,
                 children = NULL, vp = NULL,
                 childrenvp = NULL, asis = FALSE)
    elementGrob(el, name = NULL, attrs = NULL,
                namespace = NULL, namespaceDefinitions = NULL,
                children = NULL, vp = NULL,
                childrenvp = NULL, asis = FALSE)
    grid.textNode(text, name = NULL, vp = NULL)
    textNodeGrob(text, name = NULL, vp = NULL)

### Arguments

`el` | The name of the SVG element to create, e.g. "rect".
`text` | A single element character vector of text directly into insert into the SVG image.
`name` | A character identifier.
`attrs` | A list, where the names are SVG attribute names, and values are the values given to the SVG attributes.
`namespace` | A character vector specifying the namespace for this new element.
`namespaceDefinitions` | A character vector or a list with each element being a string. These give the URIs identifying the namespaces uniquely. The elements should have names which are used as prefixes. A default namespace has "" as the name. The values here are used only for defining new namespaces and not for determining the namespace to use for this particular element.
`children` | A gList object containing children of this element (if any).
`vp` | A viewport object to draw within.
`childrenvp` | A viewport object to use for the children of the element grob.
`asis` | If `TRUE`, SVG id attributes will be generated from the `name` with no modification so that we can easily refer to the generated elements.

### Value

An `element.grob` object. For `grid.textNode` a `textnode.grob` object.

### Author(s)

Simon Potter

### See Also

`grid.export`

[Package gridSVG version 1.6-0 Index]