VIGNETTE

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.

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)
names(trios)
names(quads)

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())
knitr::kable(sanzo.info3())
knitr::kable(sanzo.info4())

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)


Try the sanzo package in your browser

Any scripts or data that you put into this service are public.

sanzo documentation built on Jan. 12, 2020, 4:09 p.m.