If you use tcltk package package, you can do: > as.character(.Tcl("tk_chooseColor"))
Best, Philippe Greg Snow wrote:
I don't know of any existing palettes that meet your conditions, but here are a couple of options for interactive exploration of colorsets (this is quick and dirty, there are probably some better orderings, base colors, etc.): colpicker <- function( cols=colors() ) { n <- length(cols) nr <- ceiling(sqrt(n)) nc <- ceiling( n/nr ) imat <- matrix(c(seq_along(cols), rep(NA, nr*nc-n) ), ncol=nc, nrow=nr) image( seq.int(nr),seq.int(nc), imat, col=cols, xlab='', ylab='' ) xy <- locator() cols[ imat[ cbind( round(xy$x), round(xy$y) ) ] ] } colpicker() ## another approach library(TeachingDemos) cols <- colors() n <- length(cols) par(xpd=TRUE) # next line only works on windows HWidentify( (1:n) %% 26, (1:n) %/% 26, label=cols, col=cols, pch=15, cex=2 ) # next line works on all platforms with tcltk HTKidentify( (1:n) %% 26, (1:n) %/% 26, label=cols, col=cols, pch=15, cex=2 ) # reorder cols.rgb <- col2rgb( cols ) d <- dist(t(cols.rgb)) clst <- hclust(d) colpicker(cols[clst$order]) HWidentify( (1:n) %% 26, (1:n) %/% 26, label=cols[clst$order], col=cols[clst$order], pch=15, cex=2 ) ## or HTKidentify cols.hsv <- rgb2hsv( cols.rgb ) d2 <- dist(t(cols.hsv)) clst2 <- hclust(d2) HWidentify( (1:n) %% 26, (1:n) %/% 26, label=cols[clst2$order], col=cols[clst2$order], pch=15, cex=2 ) ## or HTKidentify Hope this helps,
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.