Author: Jacqueline R.M.A. Maasch

# VIGNETTE

#### Jacqueline R.M.A. Maasch

# `sanzo` | Color Palettes Based on the Works of Sanzo Wada

An R package by JRMA Maasch (2019).

This vignette is intended to share function documentation and code for several different use cases. Find further information and suggested uses at https://github.com/jmaasch/sanzo.

## Load package

    # Install development version of package, if needed.
    devtools::install_github("jmaasch/sanzo")

    # Load package.
    library(sanzo)

## Functions.

- `sanzo.duo(palette_name)` : return duo palette
- `sanzo.trio(palette_name)` : return trio palette
- `sanzo.quad(palette_name)` : return quad palette
- `sanzo.demo2()` : print demo plots for all duo palettes
- `sanzo.demo3()` : print demo plots for all trio palettes
- `sanzo.demo4()` : print demo plots for all quad palettes
- `sanzo.demo.all()` : print demo plots for all palettes
- `sanzo.info2()` : return data frame of hexadecimals and urls for all duo palettes
- `sanzo.info3()` : return data frame of hexadecimals and urls for all trio palettes
- `sanzo.info4()` : return data frame of hexadecimals and urls for all quad palettes
- `sanzo.info.all()` : return data frame of hexadecimals and urls for all palettes

## View function documentation.

Precede any function by a question mark to access description, arguments, return value, and usage suggestions.

    # Examples:
    ?sanzo.info2()
    ?sanzo.trio()

## View metadata for all duos, trios, and quads.

To quickly access palette names:

    names(duos)

    ##  [1] "c006" "c007" "c008" "c033" "c035" "c047" "c070" "c071" "c074" "c079"
    ## [11] "c085" "c091" "c095" "c102" "c103" "c106" "c114" "c118" "c119" "c229"

    names(trios)

    ##  [1] "c121" "c139" "c142" "c148" "c149" "c157" "c163" "c171" "c172" "c174"
    ## [11] "c194" "c204" "c205" "c207" "c223" "c226" "c232" "c239" "c240" "c343"

    names(quads)

    ##  [1] "c249" "c252" "c263" "c268" "c271" "c273" "c279" "c283" "c289" "c293"
    ## [11] "c296" "c302" "c310" "c321" "c329" "c330" "c332" "c339" "c341" "c348"

The following functions return a data frame containing long-form names, short-form IDs, hexadecimal values, and links to Dain M. Blodorn Kim’s https://sanzo-wada.dmbk.io for further palette information.

    knitr::kable(sanzo.info2())

DUO PALETTE | ID | HEX VALUES | URL
--- | --- | --- | ---
Combination 6 | c006 | #ff616b, #000831 | https://sanzo-wada.dmbk.io/combination/6
Combination 7 | c007 | #ff5200, #b3e8c2 | https://sanzo-wada.dmbk.io/combination/7
Combination 8 | c008 | #c2612c, #b8b8ff | https://sanzo-wada.dmbk.io/combination/8
Combination 33 | c033 | #b85e00, #1b3644 | https://sanzo-wada.dmbk.io/combination/33
Combination 35 | c035 | #b08699, #a10b2b | https://sanzo-wada.dmbk.io/combination/35
Combination 47 | c047 | #c9303e, #bfabcc | https://sanzo-wada.dmbk.io/combination/47
Combination 70 | c070 | #b85e00, #405416 | https://sanzo-wada.dmbk.io/combination/70
Combination 71 | c071 | #a90636, #d99e73 | https://sanzo-wada.dmbk.io/combination/71
Combination 74 | c074 | #b5ffc2, #2dbc94 | https://sanzo-wada.dmbk.io/combination/74
Combination 79 | c079 | #651300, #2dbc94 | https://sanzo-wada.dmbk.io/combination/79
Combination 85 | c085 | #c74300, #008aa1 | https://sanzo-wada.dmbk.io/combination/85
Combination 91 | c091 | #5c2c45, #c05200 | https://sanzo-wada.dmbk.io/combination/91
Combination 95 | c095 | #681916, #06004f | https://sanzo-wada.dmbk.io/combination/95
Combination 102 | c102 | #ebd999, #c05200 | https://sanzo-wada.dmbk.io/combination/102
Combination 103 | c103 | #c2612c, #2d0060 | https://sanzo-wada.dmbk.io/combination/103
Combination 106 | c106 | #008aa1, #06004f | https://sanzo-wada.dmbk.io/combination/106
Combination 114 | c114 | #ffab00, #008aa1 | https://sanzo-wada.dmbk.io/combination/114
Combination 118 | c118 | #e0b81f, #362304 | https://sanzo-wada.dmbk.io/combination/118
Combination 119 | c119 | #a6e6db, #0d2b52 | https://sanzo-wada.dmbk.io/combination/119
Combination 229 | c229 | #172713, #b5d1cc | https://sanzo-wada.dmbk.io/combination/229

    knitr::kable(sanzo.info3())

TRIO PALETTE | ID | HEX VALUES | URL
--- | --- | --- | ---
Combination 121 | c121 | #6c2b11, #d99e73, #405416 | https://sanzo-wada.dmbk.io/combination/121
Combination 139 | c139 | #96bfe6, #000831, #b5d1cc | https://sanzo-wada.dmbk.io/combination/139
Combination 142 | c142 | #9e194d, #baa600, #96bfe6 | https://sanzo-wada.dmbk.io/combination/142
Combination 148 | c148 | #d1bd19, #ffab00, #29bdad | https://sanzo-wada.dmbk.io/combination/148
Combination 149 | c149 | #d1bd19, #ff5200, #0f261f | https://sanzo-wada.dmbk.io/combination/149
Combination 157 | c157 | #6f0043, #d1bd19, #4f8fe6 | https://sanzo-wada.dmbk.io/combination/157
Combination 163 | c163 | #ffe600, #b5ffc2, #008aa1 | https://sanzo-wada.dmbk.io/combination/163
Combination 171 | c171 | #730f1f, #ff8c00, #b3e8c2 | https://sanzo-wada.dmbk.io/combination/171
Combination 172 | c172 | #c2612c, #008aa1, #3400a3 | https://sanzo-wada.dmbk.io/combination/172
Combination 174 | c174 | #ffa6d9, #bfabcc, #6b2e63 | https://sanzo-wada.dmbk.io/combination/174
Combination 194 | c194 | #fa2b00, #ffcfc4, #4f8fe6 | https://sanzo-wada.dmbk.io/combination/194
Combination 204 | c204 | #b319ab, #c2612c, #a6e6db | https://sanzo-wada.dmbk.io/combination/204
Combination 205 | c205 | #730f1f, #f59994, #2619d1 | https://sanzo-wada.dmbk.io/combination/205
Combination 207 | c207 | #9b5348, #b3e8c2, #000000 | https://sanzo-wada.dmbk.io/combination/207
Combination 223 | c223 | #b08699, #d99e73, #b5ffc2 | https://sanzo-wada.dmbk.io/combination/223
Combination 226 | c226 | #5c2c45, #ffb852, #2619d1 | https://sanzo-wada.dmbk.io/combination/226
Combination 232 | c232 | #d60036, #f2ad78, #000831 | https://sanzo-wada.dmbk.io/combination/232
Combination 239 | c239 | #b08699, #c4bf33, #b3e8c2 | https://sanzo-wada.dmbk.io/combination/239
Combination 240 | c240 | #ff788c, #ffff00, #29bdad | https://sanzo-wada.dmbk.io/combination/240
Combination 343 | c343 | #a93400, #ebd999, #505423 | https://sanzo-wada.dmbk.io/combination/343

    knitr::kable(sanzo.info4())

QUAD PALETTE | ID | HEX VALUES | URL
--- | --- | --- | ---
Combination 249 | c249 | #681916, #c0b490, #d1bd19, #417777 | https://sanzo-wada.dmbk.io/combination/249
Combination 252 | c252 | #e62e73, #b85e00, #baa600, #2dbc94 | https://sanzo-wada.dmbk.io/combination/252
Combination 263 | c263 | #a93400, #f2ad78, #b5ffc2, #1b3644 | https://sanzo-wada.dmbk.io/combination/263
Combination 268 | c268 | #b08699, #b85e00, #172713, #bfffe6 | https://sanzo-wada.dmbk.io/combination/268
Combination 271 | c271 | #b90078, #94ff94, #2dbc94, #0f261f | https://sanzo-wada.dmbk.io/combination/271
Combination 273 | c273 | #ffb3f0, #6f0043, #9b5348, #b5d1cc | https://sanzo-wada.dmbk.io/combination/273
Combination 279 | c279 | #b85e00, #f59994, #c0b490, #0d2b52 | https://sanzo-wada.dmbk.io/combination/279
Combination 283 | c283 | #a7374b, #730f1f, #85b857, #6bffb3 | https://sanzo-wada.dmbk.io/combination/283
Combination 289 | c289 | #f2ff26, #bdf226, #202d85, #06004f | https://sanzo-wada.dmbk.io/combination/289
Combination 293 | c293 | #b85e00, #b5ffc2, #65a98f, #40c945 | https://sanzo-wada.dmbk.io/combination/293
Combination 296 | c296 | #f5f5b8, #d99e73, #5e4017, #1b3644 | https://sanzo-wada.dmbk.io/combination/296
Combination 302 | c302 | #ffb852, #c0b490, #bfffe6, #008aa1 | https://sanzo-wada.dmbk.io/combination/302
Combination 310 | c310 | #f5f5b8, #f2ad78, #718600, #172713 | https://sanzo-wada.dmbk.io/combination/310
Combination 321 | c321 | #b08699, #f5f5b8, #172713, #96bfe6 | https://sanzo-wada.dmbk.io/combination/321
Combination 329 | c329 | #ffb852, #bfabcc, #340059, #1b3644 | https://sanzo-wada.dmbk.io/combination/329
Combination 330 | c330 | #bcd382, #bfffe6, #96bfe6, #2dbc94 | https://sanzo-wada.dmbk.io/combination/330
Combination 332 | c332 | #ff7399, #d50c42, #172713, #00592e | https://sanzo-wada.dmbk.io/combination/332
Combination 339 | c339 | #d99e73, #de4500, #a6e6db, #202d85 | https://sanzo-wada.dmbk.io/combination/339
Combination 341 | c341 | #ff616b, #328e13, #172713, #a6e6db | https://sanzo-wada.dmbk.io/combination/341
Combination 348 | c348 | #bcd382, #328e13, #172713, #340059 | https://sanzo-wada.dmbk.io/combination/348

## View palette demos.

To illustrate their potential, each color combination can be demo’d via base R scatter and bar plots.

For easier viewing, try gridding up (NOTE – this will alter `par` settings):

    # Set up gridded layout, if desired:
    graphics::layout(matrix(1:4, nrow = 2))
    graphics::par(mar = c(2, 2, 2, 2))

    # Print demo plots for duos.
    sanzo.demo2()

    # Print demo plots for trios.
    sanzo.demo3()

    # Print demo plots for quads.
    sanzo.demo4()

    # Print demo plots for all palettes.
    sanzo.demo.all()

The output of `sanzo.demo2()`, `sanzo.demo3()`, `sanzo.demo4()`, and `sanzo.demo.all()` can be previewed at https://github.com/jmaasch/sanzo.

## Use with `ggplot2`.

View examples of use with `ggplot2` at https://github.com/jmaasch/sanzo.

## Use with base R.

These examples use data from the `datasets` package and should be replicable.

### Scatter plot.

    graphics::plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20,
                   main = "Combination 121", ylab = "", xlab = "",
                   col = sanzo.trio("c121") [unclass(iris$Species)])

### Bar plot.

    graphics::barplot(BOD$demand, col = sanzo.trio("c239"),
                      main = "Combination 239", ylim = c(0, 20), border = NA)