This post shows how to build a palette with RColorBrewer and use it in a base R chart.
The RColorBrewer package offers about 25 different color palettes for R. To build a color palette using it, use the brewer.pal() function.
RColorBrewer
brewer.pal()
Note: if you need more than 7 colors, read this post.
Note: visit this post for a complete list of the available palettes.
# No margin par(mar=c(0,0,1,0)) # Load RColorBrewer library(RColorBrewer) # Build a color palette, 5 colors coming from the BuPu color palette" coul <- brewer.pal(5, "BuPu") # Build a pie chart with it pie(rep(1, length(coul)), col = coul , main="")
Related chart types
This document is a work by Yan Holtz. Any feedback is highly encouraged. You can fill an issue on Github, drop me a message on Twitter, or send an email pasting yan.holtz.data with gmail.com.