colorbrewer {epitools} | R Documentation |
Display and create ColorBrewer palettes based on Cindy Brewer's website at www.colorbrewer.org.
colorbrewer.display(nclass = 5, type = c("qualitative", "sequential", "diverging"), col.bg = "white") colorbrewer.palette(nclass = 5, type = c("qualitative", "sequential", "diverging"), palette = letters[1:18]) colorbrewer.data()
nclass |
number of classes or categories to be compared graphically |
type |
select either 'qualitative' (default), 'sequential', or 'diverging' |
col.bg |
set background color (default is white) |
palette |
select palette (letter) from displayed plot |
These R functions includes color specifications and designs developed by Cynthia Brewer (http://www.colorbrewer.org). 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 http://www.colorbrewer.org.
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
www.colorbrewer.org 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
Visit http://www.epitools.net for the latest.
Tomas Aragon, aragon@berkeley.edu, http://www.medepi.com
ColorBrewer, by Cynthia Brewer, Pennsylvanis State University, cbrewer@psu.edu, http://www.colorbrewer.org accessed on 2004-11-26
epitools
package: colors.plot
RColorBrewer
package: brewer.pal
,
display.brewer.pal
,
display.brewer.all
##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") cbrewer.9s ##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)