Closed dmurdoch closed 1 year ago
This code (based on code from Martin Maechler) isn't working:
crgb <- col2rgb(cc <- colors()) colnames(crgb) <- cc t(crgb) # The whole table ccodes <- c(256^(2:0) %*% crgb) # = internal codes ## How many names are 'aliases' of each other: table(tcc <- table(ccodes)) length(uc <- unique(sort(ccodes))) # 502 ## All the multiply named colors: mult <- uc[tcc >= 2] cl <- lapply(mult, function(m) cc[ccodes == m]) names(cl) <- apply(col2rgb(sapply(cl, function(x)x[1])), 2, function(n)paste(n, collapse = ",")) utils::str(cl) tc <- t(crgb[, !duplicated(ccodes)]) cNms <- rownames(tc) ## The 8 corners of the color cube: isC <- rowSums(tc == 0 | tc == 255) == 3 cNms[isC] # "white" "black" "blue" "cyan" "green" "magenta" "red" "yellow" table(is.gray <- tc[,1] == tc[,2] & tc[,2] == tc[,3])# (397, 105) if(require("rgl")) { ## Look at the color cube dynamically : # default type "p": no rendering => better colors plot3d (tc, col = cNms, size = 11) hover3d(tc, labels=cNms, adj = -1/4) }
In R, no label appears. In rglwidget() display, sometimes it gives an error about the id being an object.
rglwidget()
This code (based on code from Martin Maechler) isn't working:
In R, no label appears. In
rglwidget()
display, sometimes it gives an error about the id being an object.