Skip to contents

This function returns a color value for each row of the 3-column dataset supplied, by transforming the input data and using it as RGB values.

Usage

colors3d(data, trans = "none", order = 1, inversion = 1, opacity = NULL)

Arguments

data

Matrix or data frame with 3 numeric columns.

trans

Either "none" (defaut, histogram is rescaled) or "rank" (histogram is flattened).

order

Integer from 1 to 6, each denoting a unique permutation of variables-to-color band mapping. Under the default value of 1, the three variables in `data` are respectively mapped onto the R, G, and B bands of colorspace.

inversion

Integer from 1 to 8, each denoting a unique combination of variables to reverse before mapping. Under the default value of 1, all three variables are mapped with positive values at the high end of the color band. Together with the `order` parameter, this allows all possible 48 unique mappings of a given set of variables onto 3D colorspace.

opacity

Not currently used.

Value

Character vector of colors.

Examples

d <- expand.grid(x = 1:49, y = 1:49)
d$z <- cos(sqrt((d$x-25)^2 + (d$y-25)^2))
plot(d[, 1:2], col = colors3d(d), pch = 15, cex = 2)


plot(d[, 1:2], col = colors3d(d, order = 2, inversion = 2), pch = 15, cex = 2)