Description Usage Arguments Value Author(s) References See Also Examples
In SVG, one can represent style settings (e.g.
stroke, stroke-width, fill and so on)
using separate SVG attributes or as a single
style
attribute with a value that
lists all the settings in CSS form, i.e.
with ';'-separated name: value pairs.
So <g stroke="red" stroke-width="3" fill="blue">
can also be written as
<g style="stroke: red; stroke-width: 3; fill: blue">
This function and its methods allow us to convert from the CSS form to the separate-attribute form. This can make processing the document and its elements easier in both R and Javascript. It does mean that we cannot use a CSS file to specify and control the appearances of the nodes.
This function and methods operate on a document, an individual node,
a list of nodes, or an XMLNodeSet
returned from
getNodeSet
.
1 | convertCSSStylesToSVG(nodes, ...)
|
nodes |
an XML node ( |
... |
additional parameters for the methods |
The updated object with the modified internal nodes.
Duncan Temple Lang
http://www.w3.org/TR/SVG11/styling.html
1 2 3 4 5 6 7 8 9 | doc = svgPlot(plot(1:10, pch = c("red", "blue")), asXML = TRUE)
nodes = getNodeSet(doc, "//*[@style]")
convertCSSStylesToSVG(nodes[[1]])
nodes = getNodeSet(doc, "//*[@style]")
convertCSSStylesToSVG(nodes)
doc = svgPlot(plot(1:10, pch = c("red", "blue")), asXML = TRUE)
convertCSSStylesToSVG(doc)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.