Description Usage Arguments Value Author(s) See Also Examples
This function is for making an matrix plot or parallel coordinates plot interactive by allowing the viewer to mouse over a series to highlight it by enlarging its width and potentially changing its color. This helps to identify individual series when they are heavily overlayed and "tangled".
The function getMatplotSeries
is a lower-level function that
can be used to find the SVG nodes that correspond to the polylines
that draw each series. Each series will have a single node.
One can fetch these nodes with this function and then, e.g., add
tooltips, associate them with legend items, etc.
1 2 3 | highlightMatplot(doc, color = "null", factor = 3, series = getMatplotSeries(doc),
ids = seq(along = series),
js = system.file("JavaScript", "imatplot.js", package = "SVGAnnotation"))
|
doc |
the SVG document (or the name of a file which contains the SVG document) |
color |
a string giving a color (in JavaScript notation) that is used when highlighting a series to change the color of the line to that color. |
factor |
a scaling factor as a number that is used to change the width of the line for the highlighted series. One can use a value of 1.0 to specify no change in width. |
series |
a list of XML nodes identifying the poly-lines for each
series. Each series has a single node. One can fetch these from the
plot using the function |
ids |
a vector of values that are used as id attributes on the
XML nodes in |
js |
the JavaScript code to add to the plot |
The updated SVG document.
Duncan Temple Lang
1 2 3 4 5 | if(require(MASS)) {
doc = svgPlot(parcoord(mtcars))
highlightMatplot(doc, "red")
saveXML(doc, "imtcars.svg")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.