Purpose
To explore RColorBrewer package in R

Qualitative Schemes

Paired Scheme: Categories are visually related. Series of lightness pairs Accent Scheme: Use to accent small areas or important areas with colors that are more saturated / darker/lighter than others in the scheme

> library(RColorBrewer)
> rand.data <- as.data.frame(replicate(8, rnorm(100, 100, sd = 1.5)))
> colnames(rand.data) <- letters[1:8]

Accent

> boxplot((rand.data), col = brewer.pal(8, "Accent"))

ColorBrewer-002.jpg

Dark2

> boxplot((rand.data), col = brewer.pal(8, "Dark2"))

ColorBrewer-003.jpg

Paired

> boxplot((rand.data), col = brewer.pal(8, "Paired"))

ColorBrewer-004.jpg

Pastel1

> boxplot((rand.data), col = brewer.pal(8, "Pastel1"))

ColorBrewer-005.jpg

Pastel2

> boxplot((rand.data), col = brewer.pal(8, "Pastel2"))

ColorBrewer-006.jpg

Set1

> boxplot((rand.data), col = brewer.pal(8, "Set1"))

ColorBrewer-007.jpg

Set2

> boxplot((rand.data), col = brewer.pal(8, "Set2"))

ColorBrewer-008.jpg

Set3

> boxplot((rand.data), col = brewer.pal(8, "Set3"))

ColorBrewer-009.jpg

Pie Chart

> rand.data <- (replicate(8, rnorm(100, 100, sd = 1.5)))
> table.data <- table(round(rand.data))
> pie(table.data, col = brewer.pal(8, "Set2"))

ColorBrewer-010.jpg

Use of Sequential Pallete

> counts <- cbind(sort(runif(8)) * 10, sort(runif(8)) * 10, sort(runif(8)) *
+     10)

Blues

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "Blues"), )

ColorBrewer-012.jpg

BuGn

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "BuGn"), )

ColorBrewer-013.jpg

GnBu

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "GnBu"), )

ColorBrewer-014.jpg

Greens

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "Greens"), )

ColorBrewer-015.jpg

Greys

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "Greys"), )

ColorBrewer-016.jpg

Oranges

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "Oranges"), )

ColorBrewer-017.jpg

PuBu

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "PuBu"), )

ColorBrewer-018.jpg

PuBuGn

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "PuBuGn"), )

ColorBrewer-019.jpg

PuRd

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "PuRd"), )

ColorBrewer-020.jpg

Purples

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "Purples"), )

ColorBrewer-021.jpg

RdPu

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "RdPu"), )

ColorBrewer-022.jpg

Reds

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "Reds"), )

ColorBrewer-023.jpg

YlGn

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "YlGn"), )

ColorBrewer-024.jpg

YlGnBu

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "YlGnBu"), )

ColorBrewer-025.jpg

YlOrBr

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "YlOrBr"), )

ColorBrewer-026.jpg

YlOrRd

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "YlOrRd"), )

ColorBrewer-027.jpg

BrBG

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "BrBG"), )

ColorBrewer-028.jpg

PiYG

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "PiYG"), )

ColorBrewer-029.jpg

PRGn

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "PRGn"), )

ColorBrewer-030.jpg

PuOr

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "PuOr"), )

ColorBrewer-031.jpg

RdGy

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "RdGy"), )

ColorBrewer-032.jpg

RdYlBu

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "RdYlBu"), )

ColorBrewer-033.jpg

RdYlGn

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "RdYlGn"), )

ColorBrewer-034.jpg

Spectral

> barplot(counts, main = "Car Distribution by Gears and VS", xlab = "Number of Gears",
+     col = brewer.pal(8, "Spectral"), )

ColorBrewer-035.jpg

> mypalette <- brewer.pal(7, "Greens")
> image(1:7, 1, as.matrix(1:7), col = mypalette, xlab = "Greens (sequential)",
+     ylab = "", xaxt = "n", yaxt = "n", bty = "n")

ColorBrewer-036.jpg

> display.brewer.pal(7, "BrBG")

ColorBrewer-037.jpg

> display.brewer.pal(7, "Accent")

ColorBrewer-038.jpg

> display.brewer.all(n = 10, exact.n = FALSE)

ColorBrewer-039.jpg

> display.brewer.all(n = 10)

ColorBrewer-040.jpg

> display.brewer.all()

ColorBrewer-041.jpg

> display.brewer.all(type = "div")

ColorBrewer-042.jpg

> display.brewer.all(type = "seq")

ColorBrewer-043.jpg

> display.brewer.all(type = "qual")

ColorBrewer-044.jpg

> display.brewer.all(n = 5, type = "div", exact.n = TRUE)

ColorBrewer-045.jpg

> brewer.pal.info
         maxcolors category
BrBG            11      div
PiYG            11      div
PRGn            11      div
PuOr            11      div
RdBu            11      div
RdGy            11      div
RdYlBu          11      div
RdYlGn          11      div
Spectral        11      div
Accent           8     qual
Dark2            8     qual
Paired          12     qual
Pastel1          9     qual
Pastel2          8     qual
Set1             9     qual
Set2             8     qual
Set3            12     qual
Blues            9      seq
BuGn             9      seq
BuPu             9      seq
GnBu             9      seq
Greens           9      seq
Greys            9      seq
Oranges          9      seq
OrRd             9      seq
PuBu             9      seq
PuBuGn           9      seq
PuRd             9      seq
Purples          9      seq
RdPu             9      seq
Reds             9      seq
YlGn             9      seq
YlGnBu           9      seq
YlOrBr           9      seq
YlOrRd           9      seq
> brewer.pal.info["Blues", ]
      maxcolors category
Blues         9      seq
> brewer.pal.info["Blues", ]$maxcolors
[1] 9