getSVGMappings: Retrieving Viewport, Grob, and Reference Names as SVG IDs,...

View source: R/mapping.R

Retrieve Names Mapped to SVG IDs, CSS Selectors and XPath ExpressionsR Documentation

Retrieving Viewport, Grob, and Reference Names as SVG IDs, CSS Selectors and XPath Expressions

Description

This function gives us SVG IDs (or CSS selectors and XPath expressions) that have been created from a grob, viewport, or referenced name as a result of exporting to SVG.

Usage

getSVGMappings(name, type, result = "id")

Arguments

name

A single element character vector. This should be the name of a grob or viewport (as determined by type) present as the grid plot was exported.

type

A single element character vector, must be one of vp, grob or ref. This determines whether we are trying to get the IDs of a grob or a viewport or a referenced object like a fill pattern.

result

The type of output we want. id gives us SVG element IDs. selector gives us CSS selectors. xpath gives us XPath expressions.

Details

In order to generate unique names for SVG IDs, gridSVG output will not produce the same names as are visible on the grid display list. This function retrieves the SVG IDs associated with grob and viewport names. To use this function first requires importing mapping information, see gridSVGMappings.

To make using results easier with existing JavaScript libraries and R packages, CSS selectors and XPath expressions can be returned. This is the case when result is specified as one of selector or xpath. These are targeted to match just the SVG element itself, nothing more.

Value

A character vector representing values that can target specific SVG output.

Author(s)

Simon Potter


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