colorbrewer {epitools}R Documentation

Display and create ColorBrewer palettes


Display and create ColorBrewer palettes based on Cindy Brewer's website at


colorbrewer.display(nclass = 5,
                    type = c("qualitative", "sequential", "diverging"),
           = "white")
colorbrewer.palette(nclass = 5,
                    type = c("qualitative", "sequential", "diverging"),
                    palette = letters[1:18])



number of classes or categories to be compared graphically


select either 'qualitative' (default), 'sequential', or 'diverging'

set background color (default is white)


select palette (letter) from displayed plot


These R functions includes color specifications and designs developed by Cynthia Brewer ( For more details on color selection please visit this excellent site.

First, select the number of classes or categories to be compared (nclass). Second, select the type of comparison (qualitative vs. sequential vs. diverging). Third, use colorbrewer.display to display the available ColorBrewer palette for a given type and number of classes. Fourth, using the colorbrewer.palette function, create a color palette for use in R graphics functions (e.g, col = mypal, where mypal was created from colorbrewer.palette).

Note that you can change the background color.

ColorBrewer is Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University. All rights reserved. The ColorBrewer palettes have been included in this R package with permission of the copyright holder. Copyright and license information at

These functions for epitools were created to make the ColorBrewer palettes readily available to epitools users, and to have the same 3-step selection order as the site. A more visually appealing display of the ColorBrewer schemes is available in the RColorBrewer package.


colorbrewer.display displays ColorBrewer selection and invisibly returns data that corresponds to graphical display

colorbrewer.palette returns rgb vector palette


Tomas Aragon,,


ColorBrewer, by Cynthia Brewer, Pennsylvanis State University,, accessed on 2004-11-26

See Also

epitools package: colors.plot


##display available palettes for given nclass and type
colorbrewer.display(9, "sequential")

##change background to blue
colorbrewer.display(9, "sequential", "blue")

##display available palettes for given nclass and type,
##but also display RGB numbers to create your own palette
cbrewer.9s <- colorbrewer.display(9, "sequential")

##Display and use ColorBrewer palette
##first, display and choose palette (letter)
colorbrewer.palette(10, "q")

##second, extract and use ColorBrewer palette
mycolors <- colorbrewer.palette(nclass = 10, type = "q", palette = "b")
xx <- 1:10
yy <- outer(1:10, 1:10, "*")
matplot(xx,yy, type="l", col = mycolors, lty = 1, lwd = 4)

[Package epitools version 0.5-10.1 Index]