bivcol <- function(pal, nx=3, ny=3){
tit <- substitute(pal)
if(is.function(pal)) pal <- pal()
ncol <- length(pal)
if(missing(nx)) nx <- sqrt(ncol)
if(missing(ny)) ny <- nx
image(matrix(1:ncol, nrow=ny), axes=FALSE, col=pal)
mtext(tit)
}
op <- par(mfrow=c(4,4), mar=c(1,1,2,1))
bivcol(arc.bluepink)
bivcol(brewer.divbin, nx=3)
bivcol(brewer.divdiv)
bivcol(brewer.divseq)
bivcol(brewer.qualbin, nx=3)
bivcol(brewer.qualseq)
bivcol(brewer.seqseq1)
bivcol(brewer.seqseq2)
bivcol(census.blueyellow)
bivcol(stevens.bluered)
bivcol(stevens.greenblue)
bivcol(stevens.pinkblue)
bivcol(stevens.pinkgreen)
bivcol(stevens.purplegold)
bivcol(tolochko.redblue)
bivcol(vsup.redblue, nx=8)
par(op)
Run the code above in your browser using DataLab