| getLUV | R Documentation |
Given a character vector of colors in any format acceptable to R, this function computes their coordinates in L*u*v* color space.
getLUV(colorset)
colorset |
a vector containing color values in any format recognized by R. |
The real point of this function is to allow users to plot the colors
in three-dimensional space using the rgl package. Because
rgl depends on an external installation of XQuartz on Macintosh
computers (and because we have found that some students in courses
that we teach are apparently unable to install XQuartz, especially if
they are using institutional computers without adminstrative
privileges), Polychrome no longer imports or depends upon the
rgl package, instead relying on scatterplot3d for its 3D
plots. The example below shows how to plot a color set using
rgl.
Returns a list containing two components: (1) a three-column matrix
named coords containing the luminance (L) and hue coordinates
(U, V) of each color provided in the input colorset; and (2) a
character vector named cset containng a hexadecimal
representation of the colorset.
Kevin R. Coombes <krc@silicovore.com>
data(alphabet)
luv <- getLUV(alphabet)
scatterplot3d::scatterplot3d(luv$coords, color = luv$cset,
pch = 16, cex.symbol = 3)
## Not run:
library(rgl)
x <- luv$coords
cset <- luv$cset
open3d(windowRect=c(40, 40, 840, 840))
plot3d(x, main="Alphabet Colors")
spheres3d(x, radius=10, col=cset, shininess=100)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.