cranvas (version 0.8.5)

manual_brush: Manually brush the plot via command line

Description

We can brush a plot via command line rather than using the mouse.

Usage

manual_brush(obj, pos, pause = 0)

Arguments

obj
the plot object with an attribute meta, e.g. returned by qbar
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 pos; each element used after each mouse position)

Value

NULL

Examples

Run this code
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()

Run the code above in your browser using DataLab