Color Palettes in R using RColorBrewer #rstats

The lovely colors at http://ColorBrewer.org can be used for much better color palettes in R.

library(RColorBrewer)

display.brewer.all() 

and we use the function brewer.pal(N,”Name”) as the col  parameter for the new color palettes

where we can see name of palettes  from the list above

data(VADeaths)
par(mfrow=c(2,3))
 hist(VADeaths,col=brewer.pal(3,"Set3"),main="Set3 3 colors")
 hist(VADeaths,col=brewer.pal(3,"Set2"),main="Set2 3 colors")
 hist(VADeaths,col=brewer.pal(3,"Set1"),main="Set1 3 colors")
 hist(VADeaths,col=brewer.pal(8,"Set3"),main="Set3 8 colors")
 hist(VADeaths,col=brewer.pal(8,"Greys"),main="Greys 8 colors")
 hist(VADeaths,col=brewer.pal(8,"Greens"),main="Greens 8 colors")
Created by Pretty R at inside-R.org

Rplot7

Colors from [http://www.ColorBrewer.org] by Cynthia A. Brewer, Geography, Pennsylvania State University
• Erich Neuwirth (2011). RColorBrewer: ColorBrewer palettes. R package version 1.0-5. [http://CRAN.R-project.org/package=RColorBrewer]
Note-ColorBrewer is Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University. All rights reserved. The ColorBrewer palettes have been included in the R package with permission of the copyright holder.
Unknown's avatar

Author: Ajay Ohri

http://about.me/ajayohri

Leave a comment