sanzo
| Color Palettes Based on the Works of Sanzo WadaAn 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.
# Install development version of package, if needed. devtools::install_github("jmaasch/sanzo")
# Load package. library(sanzo)
sanzo.duo(palette_name)
: return duo palettesanzo.trio(palette_name)
: return trio palettesanzo.quad(palette_name)
: return quad palettesanzo.demo2()
: print demo plots for all duo palettessanzo.demo3()
: print demo plots for all trio palettessanzo.demo4()
: print demo plots for all quad palettessanzo.demo.all()
: print demo plots for all palettessanzo.info2()
: return data frame of hexadecimals and urls for all duo palettessanzo.info3()
: return data frame of hexadecimals and urls for all trio palettessanzo.info4()
: return data frame of hexadecimals and urls for all quad palettessanzo.info.all()
: return data frame of hexadecimals and urls for all palettesPrecede any function by a question mark to access description, arguments, return value, and usage suggestions.
# Examples: ?sanzo.info2() ?sanzo.trio()
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())
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.
ggplot2
.View examples of use with ggplot2
at https://github.com/jmaasch/sanzo.
These examples use data from the datasets
package and should be replicable.
graphics::plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, main = "Combination 121", ylab = "", xlab = "", col = sanzo.trio("c121") [unclass(iris$Species)])
graphics::barplot(BOD$demand, col = sanzo.trio("c239"), main = "Combination 239", ylim = c(0, 20), border = NA)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.