Flag3d | R Documentation |
Flag3d(select, x = pars$data[[pars$names["x"]]], y = pars$data[[pars$names["y"]]], z = pars$data[[pars$names["z"]]], labels = rownames(Plot3d.par("data")), groups = NULL, col = Plot3d.par()$col, adj = 0, debug = FALSE, pad = 0, offset = ((100/length(x))^(1/3)) * 0.02, ...)
select |
a vector of labels to display. Elements will be displayed if they match a label for a point in the 3d display. |
x,y,z,labels,groups,col |
generally obtained from the 3d global object returned with Plot3d.par() |
adj |
is passed to rgl.texts |
debug |
|
pad |
number of character to pad labels on the left. |
offset |
|
... |
passed to rgl.texts |
Returns the vector of elements in select
that were matched in labels
.
G. Monette (borrowing heavily from J. Fox)
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (select, x = pars$data[[pars$names["x"]]], y = pars$data[[pars$names["y"]]],
z = pars$data[[pars$names["z"]]], labels = rownames(Plot3d.par("data")),
groups = NULL, col = Plot3d.par()$col, adj = 0, debug = FALSE,
pad = 0, offset = ((100/length(x))^(1/3)) * 0.02, ...)
{
pars <- Plot3d.par()
if ((is.matrix(x) && (ncol(x) > 1)) || is.data.frame(x)) {
dat <- x
x <- dat[, 1]
y <- dat[, 2]
z <- dat[, 3]
if (missing(labels))
labels <- rownames(dat)
}
if (pars$has.groups && missing(groups)) {
groups <- pars$data[[pars$names["g"]]]
}
valid <- if (is.null(groups))
complete.cases(x, y, z)
else complete.cases(x, y, z, groups)
x <- x[valid]
y <- y[valid]
z <- z[valid]
labels <- labels[valid]
pad <- paste(rep(" ", pad), collapse = "")
labels.pad <- paste(pad, labels)
rgl.bringtotop()
groups <- if (!is.null(groups))
as.numeric(groups[valid])
if (is.numeric(select) || is.logical(select))
select <- labels[which]
which <- labels %in% select
if (!is.null(groups))
cols <- col[groups][which]
else cols <- col[1]
rgl.texts(x[which], y[which] + offset, z[which], labels.pad[which],
color = cols, adj = adj, ...)
labels[which]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.