## ----------------------------------------------------------------------------- library(Polychrome) ## ----------------------------------------------------------------------------- data(alphabet) ## ----fig.width=7, fig.height=5------------------------------------------------ swatch(alphabet) ## ----manycolors--------------------------------------------------------------- cn <- colorNames(alphabet) # from UNIX rgb.txt file cc <- isccNames(alphabet) # standards from the Inter-Society Color Council xk <- xkcdNames(alphabet) # from the xkCd online color survey df <- data.frame(UNIX = cn, ISCC = cc, XKCD = xk) rownames(df) <- names(alphabet) df ## ----dups--------------------------------------------------------------------- apply(df, 2, function(X) length(unique(X))) dupn <- df$ISCC[duplicated(df$ISCC)] tmp <- df[df$ISCC %in% dupn,] tmp[order(tmp[,2]),] ## ----fig.width=12, fig.height=12---------------------------------------------- data(xkcd) data(iscc) colMat <- col2rgb(colors()) opar <- par(mfrow = c(2,2)) unix <- rgb(red = colMat[1, ]/255, green = colMat[2, ]/255, blue = colMat[3, ]/255) uvscatter(alphabet, xlim = c(-80, 160), ylim =c (-130, 125)) uvscatter(iscc$Hex, xlim = c(-80, 160), ylim =c (-130, 125), main = "ISCC") uvscatter(unix, xlim = c(-80, 160), ylim =c (-130, 125), main = "UNIX") uvscatter(xkcd$Hex, xlim = c(-80, 160), ylim =c (-130, 125), main = "XKCD") par(opar)