Description Usage Arguments Value Author(s) Examples
We can brush a plot via command line rather than using the mouse.
1 | manual_brush(obj, pos, pause = 0)
|
obj |
the plot object with an attribute |
pos |
the mouse position(s); can be a numeric vector of length 2 or a matrix of 2 columns with each row representing a mouse position |
pause |
the time to pause between two successive mouse positions
(recycled to the same length of |
NULL
Yihui Xie <http://yihui.name>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | library(cranvas)
qnrc <- qdata(nrcstat, color = RegCode)
(o1 <- qbar(RegCode, qnrc))
(o2 <- qparallel(vars = 13:10, data = qnrc, main = "Overview of Rankings",
glyph = "tick", horizontal = FALSE, boxplot = TRUE))
## automatically brush the bar plot
brush(qnrc, "style")$color <- "brown"
l <- attr(o1, "meta")$limits
# interpolate some random positions
p <- approx(runif(50, l[1, 1], l[2, 1]), runif(50, l[1, 2], l[2, 2]),
n = 500)
manual_brush(o1, cbind(p$x, p$y), pause = if (interactive()) 0.1 else 0)
## can also brush the par-coords plot
manual_brush(o2, as.matrix(expand.grid(seq(0, 1, 0.1), (1:4) - 0.1)),
pause = if (interactive()) 0.2 else 0)
cranvas_off()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.