├── R ├── .Rhistory ├── duos.R ├── trios.R ├── quads.R ├── info.R └── demo.R ├── .gitignore ├── vignettes ├── .gitignore └── sanzo_vignette.Rmd ├── .DS_Store ├── dev ├── .DS_Store ├── demos4 │ ├── .DS_Store │ ├── Unknown-1.png │ ├── Unknown-2.png │ ├── Unknown-3.png │ ├── Unknown-4.png │ ├── Unknown-5.png │ ├── Unknown-6.png │ ├── Unknown-7.png │ ├── Unknown-8.png │ ├── Unknown-9.png │ └── Unknown-10.png ├── demos2 │ ├── Unknown-1.png │ ├── Unknown-2.png │ ├── Unknown-3.png │ ├── Unknown-4.png │ ├── Unknown-5.png │ ├── Unknown-6.png │ ├── Unknown-7.png │ ├── Unknown-8.png │ ├── Unknown-9.png │ └── Unknown-10.png ├── demos3 │ ├── Unknown-1.png │ ├── Unknown-2.png │ ├── Unknown-3.png │ ├── Unknown-4.png │ ├── Unknown-5.png │ ├── Unknown-6.png │ ├── Unknown-7.png │ ├── Unknown-8.png │ ├── Unknown-9.png │ └── Unknown-10.png ├── ggplot2demos │ ├── bar.png │ ├── .DS_Store │ ├── concat.png │ ├── violin.png │ ├── gradient.png │ ├── scatter1.png │ ├── scatter2.png │ ├── scatter3.png │ ├── scatter4.png │ ├── scatter5.png │ ├── bar_ggplot2.png │ ├── stacked_bar.png │ ├── bar_stacked_ggplot2.png │ └── sanzo_ggplot2_advert.png ├── sanzo_dictionary │ ├── sanzo1.jpg │ ├── sanzo2.jpg │ ├── sanzo_amazon1.jpg │ ├── sanzo_amazon2.jpg │ └── sanzo_amazon3.jpg ├── vignette_draft.rmd └── sanzo.Rmd ├── .Rbuildignore ├── NEWS.md ├── NAMESPACE ├── man ├── duos.Rd ├── quads.Rd ├── trios.Rd ├── sanzo.demo2.Rd ├── sanzo.demo3.Rd ├── sanzo.demo4.Rd ├── sanzo.demo.all.Rd ├── sanzo.info2.Rd ├── sanzo.info3.Rd ├── sanzo.info4.Rd ├── sanzo.info.all.Rd ├── sanzo.duo.Rd ├── sanzo.trio.Rd └── sanzo.quad.Rd ├── sanzo.Rproj ├── DESCRIPTION ├── cran-comments.md ├── .Rhistory └── README.md /R/.Rhistory: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | inst/doc 3 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/.DS_Store -------------------------------------------------------------------------------- /dev/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/.DS_Store -------------------------------------------------------------------------------- /dev/demos4/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos4/.DS_Store -------------------------------------------------------------------------------- /dev/demos2/Unknown-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos2/Unknown-1.png -------------------------------------------------------------------------------- /dev/demos2/Unknown-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos2/Unknown-2.png -------------------------------------------------------------------------------- /dev/demos2/Unknown-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos2/Unknown-3.png -------------------------------------------------------------------------------- /dev/demos2/Unknown-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos2/Unknown-4.png -------------------------------------------------------------------------------- /dev/demos2/Unknown-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos2/Unknown-5.png -------------------------------------------------------------------------------- /dev/demos2/Unknown-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos2/Unknown-6.png -------------------------------------------------------------------------------- /dev/demos2/Unknown-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos2/Unknown-7.png -------------------------------------------------------------------------------- /dev/demos2/Unknown-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos2/Unknown-8.png -------------------------------------------------------------------------------- /dev/demos2/Unknown-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos2/Unknown-9.png -------------------------------------------------------------------------------- /dev/demos3/Unknown-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos3/Unknown-1.png -------------------------------------------------------------------------------- /dev/demos3/Unknown-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos3/Unknown-2.png -------------------------------------------------------------------------------- /dev/demos3/Unknown-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos3/Unknown-3.png -------------------------------------------------------------------------------- /dev/demos3/Unknown-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos3/Unknown-4.png -------------------------------------------------------------------------------- /dev/demos3/Unknown-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos3/Unknown-5.png -------------------------------------------------------------------------------- /dev/demos3/Unknown-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos3/Unknown-6.png -------------------------------------------------------------------------------- /dev/demos3/Unknown-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos3/Unknown-7.png -------------------------------------------------------------------------------- /dev/demos3/Unknown-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos3/Unknown-8.png -------------------------------------------------------------------------------- /dev/demos3/Unknown-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos3/Unknown-9.png -------------------------------------------------------------------------------- /dev/demos4/Unknown-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos4/Unknown-1.png -------------------------------------------------------------------------------- /dev/demos4/Unknown-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos4/Unknown-2.png -------------------------------------------------------------------------------- /dev/demos4/Unknown-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos4/Unknown-3.png -------------------------------------------------------------------------------- /dev/demos4/Unknown-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos4/Unknown-4.png -------------------------------------------------------------------------------- /dev/demos4/Unknown-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos4/Unknown-5.png -------------------------------------------------------------------------------- /dev/demos4/Unknown-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos4/Unknown-6.png -------------------------------------------------------------------------------- /dev/demos4/Unknown-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos4/Unknown-7.png -------------------------------------------------------------------------------- /dev/demos4/Unknown-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos4/Unknown-8.png -------------------------------------------------------------------------------- /dev/demos4/Unknown-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos4/Unknown-9.png -------------------------------------------------------------------------------- /dev/ggplot2demos/bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/bar.png -------------------------------------------------------------------------------- /dev/demos2/Unknown-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos2/Unknown-10.png -------------------------------------------------------------------------------- /dev/demos3/Unknown-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos3/Unknown-10.png -------------------------------------------------------------------------------- /dev/demos4/Unknown-10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/demos4/Unknown-10.png -------------------------------------------------------------------------------- /dev/ggplot2demos/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/.DS_Store -------------------------------------------------------------------------------- /dev/ggplot2demos/concat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/concat.png -------------------------------------------------------------------------------- /dev/ggplot2demos/violin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/violin.png -------------------------------------------------------------------------------- /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^sanzo\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^dev$ 4 | ^cran-comments\.md$ 5 | ^CRAN-RELEASE$ 6 | -------------------------------------------------------------------------------- /dev/ggplot2demos/gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/gradient.png -------------------------------------------------------------------------------- /dev/ggplot2demos/scatter1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/scatter1.png -------------------------------------------------------------------------------- /dev/ggplot2demos/scatter2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/scatter2.png -------------------------------------------------------------------------------- /dev/ggplot2demos/scatter3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/scatter3.png -------------------------------------------------------------------------------- /dev/ggplot2demos/scatter4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/scatter4.png -------------------------------------------------------------------------------- /dev/ggplot2demos/scatter5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/scatter5.png -------------------------------------------------------------------------------- /dev/ggplot2demos/bar_ggplot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/bar_ggplot2.png -------------------------------------------------------------------------------- /dev/ggplot2demos/stacked_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/stacked_bar.png -------------------------------------------------------------------------------- /dev/sanzo_dictionary/sanzo1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/sanzo_dictionary/sanzo1.jpg -------------------------------------------------------------------------------- /dev/sanzo_dictionary/sanzo2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/sanzo_dictionary/sanzo2.jpg -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # NEWS 2 | 3 | ## ```sanzo``` 0.1.0 4 | * First release submitted to CRAN. 5 | * Submitted 7 January 2020. 6 | -------------------------------------------------------------------------------- /dev/sanzo_dictionary/sanzo_amazon1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/sanzo_dictionary/sanzo_amazon1.jpg -------------------------------------------------------------------------------- /dev/sanzo_dictionary/sanzo_amazon2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/sanzo_dictionary/sanzo_amazon2.jpg -------------------------------------------------------------------------------- /dev/sanzo_dictionary/sanzo_amazon3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/sanzo_dictionary/sanzo_amazon3.jpg -------------------------------------------------------------------------------- /dev/ggplot2demos/bar_stacked_ggplot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/bar_stacked_ggplot2.png -------------------------------------------------------------------------------- /dev/ggplot2demos/sanzo_ggplot2_advert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jmaasch/sanzo/HEAD/dev/ggplot2demos/sanzo_ggplot2_advert.png -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(duos) 4 | export(quads) 5 | export(sanzo.demo.all) 6 | export(sanzo.demo2) 7 | export(sanzo.demo3) 8 | export(sanzo.demo4) 9 | export(sanzo.duo) 10 | export(sanzo.info.all) 11 | export(sanzo.info2) 12 | export(sanzo.info3) 13 | export(sanzo.info4) 14 | export(sanzo.quad) 15 | export(sanzo.trio) 16 | export(trios) 17 | -------------------------------------------------------------------------------- /man/duos.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/duos.R 3 | \docType{data} 4 | \name{duos} 5 | \alias{duos} 6 | \title{List of duos} 7 | \format{An object of class \code{list} of length 20.} 8 | \usage{ 9 | duos 10 | } 11 | \description{ 12 | List containing all 20 duo palettes, defined by 13 | hexadecimal values. 14 | } 15 | \keyword{datasets} 16 | -------------------------------------------------------------------------------- /man/quads.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/quads.R 3 | \docType{data} 4 | \name{quads} 5 | \alias{quads} 6 | \title{List of quads} 7 | \format{An object of class \code{list} of length 20.} 8 | \usage{ 9 | quads 10 | } 11 | \description{ 12 | List containing all 20 quad palettes, defined by 13 | hexadecimal values. 14 | } 15 | \keyword{datasets} 16 | -------------------------------------------------------------------------------- /man/trios.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/trios.R 3 | \docType{data} 4 | \name{trios} 5 | \alias{trios} 6 | \title{List of trios} 7 | \format{An object of class \code{list} of length 20.} 8 | \usage{ 9 | trios 10 | } 11 | \description{ 12 | List containing all 20 trio palettes, defined by 13 | hexadecimal values. 14 | } 15 | \keyword{datasets} 16 | -------------------------------------------------------------------------------- /man/sanzo.demo2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/demo.R 3 | \name{sanzo.demo2} 4 | \alias{sanzo.demo2} 5 | \title{Print demo plots for all duo palettes} 6 | \usage{ 7 | sanzo.demo2() 8 | } 9 | \description{ 10 | Print demo base R plots for all 20 duo palettes to illustrate 11 | their use and display hexadecimal values. 12 | } 13 | \examples{ 14 | sanzo.demo2() 15 | 16 | } 17 | -------------------------------------------------------------------------------- /man/sanzo.demo3.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/demo.R 3 | \name{sanzo.demo3} 4 | \alias{sanzo.demo3} 5 | \title{Print demo plots for all trio palettes} 6 | \usage{ 7 | sanzo.demo3() 8 | } 9 | \description{ 10 | Print demo base R plots for all 20 trio palettes to illustrate 11 | their use and display hexadecimal values. 12 | } 13 | \examples{ 14 | sanzo.demo3() 15 | 16 | } 17 | -------------------------------------------------------------------------------- /man/sanzo.demo4.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/demo.R 3 | \name{sanzo.demo4} 4 | \alias{sanzo.demo4} 5 | \title{Print demo plots for all quad palettes} 6 | \usage{ 7 | sanzo.demo4() 8 | } 9 | \description{ 10 | Print demo base R plots for all 20 quad palettes to illustrate 11 | their use and display hexadecimal values. 12 | } 13 | \examples{ 14 | sanzo.demo4() 15 | 16 | } 17 | -------------------------------------------------------------------------------- /man/sanzo.demo.all.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/demo.R 3 | \name{sanzo.demo.all} 4 | \alias{sanzo.demo.all} 5 | \title{Print demo plots for all palettes} 6 | \usage{ 7 | sanzo.demo.all() 8 | } 9 | \description{ 10 | Print demo base R plots for all 60 sanzo palettes to illustrate 11 | their use and display hexadecimal values. 12 | } 13 | \examples{ 14 | sanzo.demo.all() 15 | 16 | } 17 | -------------------------------------------------------------------------------- /sanzo.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | AutoAppendNewline: Yes 16 | StripTrailingWhitespace: Yes 17 | 18 | BuildType: Package 19 | PackageUseDevtools: Yes 20 | PackageInstallArgs: --no-multiarch --with-keep.source 21 | PackageRoxygenize: rd,collate,namespace 22 | -------------------------------------------------------------------------------- /man/sanzo.info2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/info.R 3 | \name{sanzo.info2} 4 | \alias{sanzo.info2} 5 | \title{See metadata for all duo palettes} 6 | \usage{ 7 | sanzo.info2() 8 | } 9 | \value{ 10 | Return data frame containing long-form names, short-form IDs, 11 | hex values, and URLs for all duos. 12 | } 13 | \description{ 14 | Create data frame containing long-form names, short-form IDs, 15 | hexadecimal values, and links to Dain M. Blodorn Kim's 16 | https://sanzo-wada.dmbk.io for all duo palettes. 17 | } 18 | \examples{ 19 | duo_info_df <- sanzo.info2() 20 | print(sanzo.info2()) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/sanzo.info3.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/info.R 3 | \name{sanzo.info3} 4 | \alias{sanzo.info3} 5 | \title{See metadata for all trio palettes} 6 | \usage{ 7 | sanzo.info3() 8 | } 9 | \value{ 10 | Return data frame containing long-form names, short-form IDs, 11 | hex values, and URLs for all trios. 12 | } 13 | \description{ 14 | Create data frame containing long-form names, short-form IDs, 15 | hexadecimal values, and links to Dain M. Blodorn Kim's 16 | https://sanzo-wada.dmbk.io for all trio palettes. 17 | } 18 | \examples{ 19 | trio_info_df <- sanzo.info3() 20 | print(sanzo.info3()) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/sanzo.info4.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/info.R 3 | \name{sanzo.info4} 4 | \alias{sanzo.info4} 5 | \title{See metadata for all quad palettes} 6 | \usage{ 7 | sanzo.info4() 8 | } 9 | \value{ 10 | Return data frame containing long-form names, short-form IDs, 11 | hex values, and URLs for all quads 12 | } 13 | \description{ 14 | Create data frame containing long-form names, short-form IDs, 15 | hexadecimal values, and links to Dain M. Blodorn Kim's 16 | https://sanzo-wada.dmbk.io for all quad palettes. 17 | } 18 | \examples{ 19 | quad_info_df <- sanzo.info4() 20 | print(sanzo.info4()) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/sanzo.info.all.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/info.R 3 | \name{sanzo.info.all} 4 | \alias{sanzo.info.all} 5 | \title{See metadata for all palettes} 6 | \usage{ 7 | sanzo.info.all() 8 | } 9 | \value{ 10 | Return data frame containing long-form names, short-form IDs, 11 | hex values, and URLs for all sanzo palettes. 12 | } 13 | \description{ 14 | Create data frame containing long-form names, short-form IDs, 15 | hexadecimal values, and links to Dain M. Blodorn Kim's 16 | https://sanzo-wada.dmbk.io for all sanzo palettes. 17 | } 18 | \examples{ 19 | info_df <- sanzo.info.all() 20 | print(sanzo.info.all()) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/sanzo.duo.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/duos.R 3 | \name{sanzo.duo} 4 | \alias{sanzo.duo} 5 | \title{Generate two-colored palettes} 6 | \usage{ 7 | sanzo.duo(palette_name) 8 | } 9 | \arguments{ 10 | \item{palette_name}{The short ID for the palette, e.g. "c006". For full list of duo IDs, use sanzo.info2().} 11 | } 12 | \value{ 13 | A vector of hexademicals of length 2. 14 | } 15 | \description{ 16 | Generate two-colored palettes. 17 | } 18 | \examples{ 19 | # Assign palette to a name. 20 | my_palette <- sanzo.duo("c229") 21 | 22 | # Concatenate two duos for a custom quad. 23 | c033 <- sanzo.duo("c033") 24 | c095 <- sanzo.duo("c095") 25 | custom_quad <- c(c033, c095) 26 | 27 | # Use with base R. 28 | plot(iris$Sepal.Width, 29 | iris$Sepal.Length, 30 | col = sanzo.duo("c085")) 31 | 32 | # For examples of use with ggplot2, see https://github.com/jmaasch/sanzo. 33 | 34 | # For examples of use as a gradient, see https://github.com/jmaasch/sanzo. 35 | 36 | } 37 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: sanzo 2 | Title: Color Palettes Based on the Works of Sanzo Wada 3 | Version: 0.1.0 4 | Authors@R: 5 | person(given = "Jacqueline", 6 | family = "Maasch", 7 | role = c("aut", "cre"), 8 | email = "jacqueline.maasch@gmail.com") 9 | Description: Inspired by the art and color research of Sanzo Wada (1883-1967), 10 | his "Dictionary Of Color Combinations" (2011, ISBN:978-4861522475), and the 11 | interactive site by Dain M. Blodorn Kim , 12 | this package brings Wada's color combinations to R for easy use in data 13 | visualizations. This package honors 60 of Wada's color combinations: 14 | 20 duos, 20 trios, and 20 quads. 15 | License: GPL-3 16 | Encoding: UTF-8 17 | LazyData: true 18 | URL: https://github.com/jmaasch/sanzo 19 | BugReports: https://github.com/jmaasch/sanzo/issues 20 | RoxygenNote: 7.0.2 21 | Suggests: 22 | datasets, 23 | graphics, 24 | stats, 25 | knitr, 26 | rmarkdown 27 | VignetteBuilder: knitr 28 | -------------------------------------------------------------------------------- /man/sanzo.trio.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/trios.R 3 | \name{sanzo.trio} 4 | \alias{sanzo.trio} 5 | \title{Generate three-colored palettes} 6 | \usage{ 7 | sanzo.trio(palette_name) 8 | } 9 | \arguments{ 10 | \item{palette_name}{The short ID for the palette, e.g. "c121". For full list of trio IDs, use sanzo.info3().} 11 | } 12 | \value{ 13 | A vector of hexademicals of length 3. 14 | } 15 | \description{ 16 | Generate three-colored palettes. 17 | } 18 | \examples{ 19 | # Assign palette to a name. 20 | my_palette <- sanzo.trio("c223") 21 | 22 | # Concatenate two trios for a custom six-colored palette. 23 | c207 <- sanzo.trio("c207") 24 | c226 <- sanzo.trio("c226") 25 | custom_six <- c(c207, c226) 26 | 27 | # Use with base R. 28 | plot(iris$Sepal.Width, 29 | iris$Sepal.Length, 30 | col = sanzo.trio("c343")) 31 | 32 | # For examples of use with ggplot2, see https://github.com/jmaasch/sanzo. 33 | 34 | # For examples of use as a gradient, see https://github.com/jmaasch/sanzo. 35 | 36 | } 37 | -------------------------------------------------------------------------------- /man/sanzo.quad.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/quads.R 3 | \name{sanzo.quad} 4 | \alias{sanzo.quad} 5 | \title{Generate four-colored palettes} 6 | \usage{ 7 | sanzo.quad(palette_name) 8 | } 9 | \arguments{ 10 | \item{palette_name}{The short ID for the palette, e.g. "c263". For full list of quad IDs, use sanzo.info4().} 11 | } 12 | \value{ 13 | A vector of hexademicals of length 3. 14 | } 15 | \description{ 16 | Generate four-colored palettes. 17 | } 18 | \examples{ 19 | # Assign palette to a name. 20 | my_palette <- sanzo.quad("c252") 21 | 22 | # Concatenate two quads for a custom eight-colored palette. 23 | c348 <- sanzo.quad("c348") 24 | c341 <- sanzo.quad("c341") 25 | custom_eight <- c(c348, c341) 26 | 27 | # Use with base R. 28 | plot(iris$Sepal.Width, 29 | iris$Sepal.Length, 30 | col = sanzo.quad("c341")) 31 | 32 | # For examples of use with ggplot2, see https://github.com/jmaasch/sanzo. 33 | 34 | # For examples of use as a gradient, see https://github.com/jmaasch/sanzo. 35 | 36 | } 37 | -------------------------------------------------------------------------------- /R/duos.R: -------------------------------------------------------------------------------- 1 | #' List of duos 2 | #' 3 | #' List containing all 20 duo palettes, defined by 4 | #' hexadecimal values. 5 | #' 6 | #' @export 7 | #' 8 | duos <- list( 9 | c006 = c("#ff616b", "#000831"), 10 | c007 = c("#ff5200", "#b3e8c2"), 11 | c008 = c("#c2612c", "#b8b8ff"), 12 | c033 = c("#b85e00", "#1b3644"), 13 | c035 = c("#b08699", "#a10b2b"), 14 | c047 = c("#c9303e", "#bfabcc"), 15 | c070 = c("#b85e00", "#405416"), 16 | c071 = c("#a90636", "#d99e73"), 17 | c074 = c("#b5ffc2", "#2dbc94"), 18 | c079 = c("#651300", "#2dbc94"), 19 | c085 = c("#c74300", "#008aa1"), 20 | c091 = c("#5c2c45", "#c05200"), 21 | c095 = c("#681916", "#06004f"), 22 | c102 = c("#ebd999", "#c05200"), 23 | c103 = c("#c2612c", "#2d0060"), 24 | c106 = c("#008aa1", "#06004f"), 25 | c114 = c("#ffab00", "#008aa1"), 26 | c118 = c("#e0b81f", "#362304"), 27 | c119 = c("#a6e6db", "#0d2b52"), 28 | c229 = c("#172713", "#b5d1cc") 29 | ) 30 | 31 | #' Generate two-colored palettes 32 | #' 33 | #' Generate two-colored palettes. 34 | #' 35 | #' @param palette_name The short ID for the palette, e.g. "c006". For full list of duo IDs, use sanzo.info2(). 36 | #' 37 | #' @return A vector of hexademicals of length 2. 38 | #' 39 | #' @examples 40 | #' # Assign palette to a name. 41 | #' my_palette <- sanzo.duo("c229") 42 | #' 43 | #' # Concatenate two duos for a custom quad. 44 | #' c033 <- sanzo.duo("c033") 45 | #' c095 <- sanzo.duo("c095") 46 | #' custom_quad <- c(c033, c095) 47 | #' 48 | #' # Use with base R. 49 | #' plot(iris$Sepal.Width, 50 | #' iris$Sepal.Length, 51 | #' col = sanzo.duo("c085")) 52 | #' 53 | #' # For examples of use with ggplot2, see https://github.com/jmaasch/sanzo. 54 | #' 55 | #' # For examples of use as a gradient, see https://github.com/jmaasch/sanzo. 56 | #' 57 | #' @export 58 | #' 59 | sanzo.duo <- function(palette_name) { 60 | palette <- duos[[palette_name]] 61 | return(palette) 62 | } 63 | -------------------------------------------------------------------------------- /R/trios.R: -------------------------------------------------------------------------------- 1 | #' List of trios 2 | #' 3 | #' List containing all 20 trio palettes, defined by 4 | #' hexadecimal values. 5 | #' 6 | #' @export 7 | #' 8 | trios <- list( 9 | c121 = c("#6c2b11", "#d99e73", "#405416"), 10 | c139 = c("#96bfe6", "#000831", "#b5d1cc"), 11 | c142 = c("#9e194d", "#baa600", "#96bfe6"), 12 | c148 = c("#d1bd19", "#ffab00", "#29bdad"), 13 | c149 = c("#d1bd19", "#ff5200", "#0f261f"), 14 | c157 = c("#6f0043", "#d1bd19", "#4f8fe6"), 15 | c163 = c("#ffe600", "#b5ffc2", "#008aa1"), 16 | c171 = c("#730f1f", "#ff8c00", "#b3e8c2"), 17 | c172 = c("#c2612c", "#008aa1", "#3400a3"), 18 | c174 = c("#ffa6d9", "#bfabcc", "#6b2e63"), 19 | c194 = c("#fa2b00", "#ffcfc4", "#4f8fe6"), 20 | c204 = c("#b319ab", "#c2612c", "#a6e6db"), 21 | c205 = c("#730f1f", "#f59994", "#2619d1"), 22 | c207 = c("#9b5348", "#b3e8c2", "#000000"), 23 | c223 = c("#b08699", "#d99e73", "#b5ffc2"), 24 | c226 = c("#5c2c45", "#ffb852", "#2619d1"), 25 | c232 = c("#d60036", "#f2ad78", "#000831"), 26 | c239 = c("#b08699", "#c4bf33", "#b3e8c2"), 27 | c240 = c("#ff788c", "#ffff00", "#29bdad"), 28 | c343 = c("#a93400", "#ebd999", "#505423") 29 | ) 30 | 31 | #' Generate three-colored palettes 32 | #' 33 | #' Generate three-colored palettes. 34 | #' 35 | #' @param palette_name The short ID for the palette, e.g. "c121". For full list of trio IDs, use sanzo.info3(). 36 | #' 37 | #' @return A vector of hexademicals of length 3. 38 | #' 39 | #' @examples 40 | #' # Assign palette to a name. 41 | #' my_palette <- sanzo.trio("c223") 42 | #' 43 | #' # Concatenate two trios for a custom six-colored palette. 44 | #' c207 <- sanzo.trio("c207") 45 | #' c226 <- sanzo.trio("c226") 46 | #' custom_six <- c(c207, c226) 47 | #' 48 | #' # Use with base R. 49 | #' plot(iris$Sepal.Width, 50 | #' iris$Sepal.Length, 51 | #' col = sanzo.trio("c343")) 52 | #' 53 | #' # For examples of use with ggplot2, see https://github.com/jmaasch/sanzo. 54 | #' 55 | #' # For examples of use as a gradient, see https://github.com/jmaasch/sanzo. 56 | #' 57 | #' @export 58 | #' 59 | sanzo.trio <- function(palette_name) { 60 | palette <- trios[[palette_name]] 61 | return(palette) 62 | } 63 | -------------------------------------------------------------------------------- /cran-comments.md: -------------------------------------------------------------------------------- 1 | ## Resubmission. 2 | 3 | Original submission 7 January 2020. CRAN feedback provided and incorporated 8 January 2020. 4 | 5 | > Please add the references you are mentioning to the description field of 6 | your DESCRIPTION file in the form 7 | authors (year) 8 | authors (year) 9 | authors (year, ISBN:...) 10 | or if those are not available: 11 | with no space after 'doi:', 'arXiv:', 'https:' and angle brackets for 12 | auto-linking. 13 | (If you want to add a title as well please put it in quotes: "Title") 14 | 15 | - [x] **Feedback incorporated**: DESCRIPTION edited. 16 | 17 | > Please make sure that you do not change the user's options, par or 18 | working directory. If you really have to do so, please ensure with an 19 | *immediate* call of on.exit() that the settings are reset when the 20 | function is exited. e.g.: 21 | ... 22 | ```oldpar <- par(mfrow=c(2,2))``` # code line i 23 | ```on.exit(par(oldpar))``` # code line i + 1 24 | ... 25 | e.g.: ```sanzo.demo2()``` 26 | 27 | - [x] **Feedback incorporated**: ```par``` and ```layout``` calls removed from demo functions. 28 | - [x] **R CMD check**: re-ran check on R 3.6.2 for macOS, unaffected (see results below). 29 | 30 | ## Test environments for R CMD check. 31 | Mac and Windows via: 32 | * local macOS X install, R version 3.5.3 (2019-03-11) 33 | * local macOS X install, R version 3.6.2 (2019-12-12) 34 | * local macOS X install, R-devel 4.0.0 (2019-12-29) 35 | * win-builder (release, R version 3.6.2) 36 | 37 | ## R CMD check results. 38 | R 3.5.3, R 3.6.2, and R-devel for macOS: 39 | * There were no ERRORs, WARNINGs, or NOTEs. 40 | 41 | R 3.6.2 for Windows: 42 | * There were no ERRORs or WARNINGs. 43 | * There was 1 NOTE: 44 | 45 | > Possibly mis-spelled words in DESCRIPTION: 46 | Blodorn (11:16) 47 | Dain (11:8) 48 | Sanzo (2:45, 9:56) 49 | Wada (2:51, 9:62) 50 | Wada's (11:49, 13:5) 51 | 52 | These words are each names and none are misspelled. 53 | 54 | ## Beta testing. 55 | This package was beta tested by colleagues running **macOS 10.15.1** (R 3.6.1) and **Ubuntu 18.04.3 LTS** (R 3.4.4). No problems were encountered. 56 | -------------------------------------------------------------------------------- /R/quads.R: -------------------------------------------------------------------------------- 1 | #' List of quads 2 | #' 3 | #' List containing all 20 quad palettes, defined by 4 | #' hexadecimal values. 5 | #' 6 | #' @export 7 | quads <- list( 8 | c249 = c("#681916", "#c0b490", "#d1bd19", "#417777"), 9 | c252 = c("#e62e73", "#b85e00", "#baa600", "#2dbc94"), 10 | c263 = c("#a93400", "#f2ad78", "#b5ffc2", "#1b3644"), 11 | c268 = c("#b08699", "#b85e00", "#172713", "#bfffe6"), 12 | c271 = c("#b90078", "#94ff94", "#2dbc94", "#0f261f"), 13 | c273 = c("#ffb3f0", "#6f0043", "#9b5348", "#b5d1cc"), 14 | c279 = c("#b85e00", "#f59994", "#c0b490", "#0d2b52"), 15 | c283 = c("#a7374b", "#730f1f", "#85b857", "#6bffb3"), 16 | c289 = c("#f2ff26", "#bdf226", "#202d85", "#06004f"), 17 | c293 = c("#b85e00", "#b5ffc2", "#65a98f", "#40c945"), 18 | c296 = c("#f5f5b8", "#d99e73", "#5e4017", "#1b3644"), 19 | c302 = c("#ffb852", "#c0b490", "#bfffe6", "#008aa1"), 20 | c310 = c("#f5f5b8", "#f2ad78", "#718600", "#172713"), 21 | c321 = c("#b08699", "#f5f5b8", "#172713", "#96bfe6"), 22 | c329 = c("#ffb852", "#bfabcc", "#340059", "#1b3644"), 23 | c330 = c("#bcd382", "#bfffe6", "#96bfe6", "#2dbc94"), 24 | c332 = c("#ff7399", "#d50c42", "#172713", "#00592e"), 25 | c339 = c("#d99e73", "#de4500", "#a6e6db", "#202d85"), 26 | c341 = c("#ff616b", "#328e13", "#172713", "#a6e6db"), 27 | c348 = c("#bcd382", "#328e13", "#172713", "#340059") 28 | ) 29 | 30 | #' Generate four-colored palettes 31 | #' 32 | #' Generate four-colored palettes. 33 | #' 34 | #' @param palette_name The short ID for the palette, e.g. "c263". For full list of quad IDs, use sanzo.info4(). 35 | #' 36 | #' @return A vector of hexademicals of length 3. 37 | #' 38 | #' @examples 39 | #' # Assign palette to a name. 40 | #' my_palette <- sanzo.quad("c252") 41 | #' 42 | #' # Concatenate two quads for a custom eight-colored palette. 43 | #' c348 <- sanzo.quad("c348") 44 | #' c341 <- sanzo.quad("c341") 45 | #' custom_eight <- c(c348, c341) 46 | #' 47 | #' # Use with base R. 48 | #' plot(iris$Sepal.Width, 49 | #' iris$Sepal.Length, 50 | #' col = sanzo.quad("c341")) 51 | #' 52 | #' # For examples of use with ggplot2, see https://github.com/jmaasch/sanzo. 53 | #' 54 | #' # For examples of use as a gradient, see https://github.com/jmaasch/sanzo. 55 | #' 56 | #' @export 57 | #' 58 | sanzo.quad <- function(palette_name) { 59 | palette <- quads[[palette_name]] 60 | return(palette) 61 | } 62 | -------------------------------------------------------------------------------- /vignettes/sanzo_vignette.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "VIGNETTE" 3 | author: "Jacqueline R.M.A. Maasch" 4 | output: rmarkdown::html_vignette 5 | vignette: > 6 | %\VignetteIndexEntry{sanzo_vignette} 7 | %\VignetteEngine{knitr::rmarkdown} 8 | %\VignetteEncoding{UTF-8} 9 | --- 10 | 11 | 12 | # ```sanzo``` | *Color Palettes Based on the Works of Sanzo Wada* 13 | 14 | An R package by JRMA Maasch (2019). 15 | 16 | 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. 17 | 18 | ## Load package 19 | 20 | ```{r install, warning = FALSE, error = FALSE, eval = FALSE} 21 | 22 | # Install development version of package, if needed. 23 | devtools::install_github("jmaasch/sanzo") 24 | 25 | ``` 26 | 27 | ```{r load, warning = FALSE, error = FALSE} 28 | 29 | # Load package. 30 | library(sanzo) 31 | 32 | ``` 33 | 34 | ## Functions. 35 | * ```sanzo.duo(palette_name)``` : return duo palette 36 | * ```sanzo.trio(palette_name)``` : return trio palette 37 | * ```sanzo.quad(palette_name)``` : return quad palette 38 | * ```sanzo.demo2()``` : print demo plots for all duo palettes 39 | * ```sanzo.demo3()``` : print demo plots for all trio palettes 40 | * ```sanzo.demo4()``` : print demo plots for all quad palettes 41 | * ```sanzo.demo.all()``` : print demo plots for all palettes 42 | * ```sanzo.info2()``` : return data frame of hexadecimals and urls for all duo palettes 43 | * ```sanzo.info3()``` : return data frame of hexadecimals and urls for all trio palettes 44 | * ```sanzo.info4()``` : return data frame of hexadecimals and urls for all quad palettes 45 | * ```sanzo.info.all()``` : return data frame of hexadecimals and urls for all palettes 46 | 47 | ## View function documentation. 48 | 49 | Precede any function by a question mark to access description, arguments, return value, and usage suggestions. 50 | 51 | ```{r doc} 52 | 53 | # Examples: 54 | ?sanzo.info2() 55 | ?sanzo.trio() 56 | 57 | ``` 58 | 59 | ## View metadata for all duos, trios, and quads. 60 | 61 | To quickly access palette names: 62 | 63 | ```{r names} 64 | 65 | names(duos) 66 | names(trios) 67 | names(quads) 68 | 69 | ``` 70 | 71 | 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. 72 | 73 | ```{r info} 74 | 75 | knitr::kable(sanzo.info2()) 76 | knitr::kable(sanzo.info3()) 77 | knitr::kable(sanzo.info4()) 78 | 79 | ``` 80 | 81 | 82 | ## View palette demos. 83 | 84 | To illustrate their potential, each color combination can be demo'd via base R scatter and bar plots. 85 | 86 | For easier viewing, try gridding up (**NOTE** -- this will alter ```par``` settings): 87 | 88 | ```{r grid, eval = FALSE} 89 | 90 | # Set up gridded layout, if desired: 91 | graphics::layout(matrix(1:4, nrow = 2)) 92 | graphics::par(mar = c(2, 2, 2, 2)) 93 | 94 | # Print demo plots for duos. 95 | sanzo.demo2() 96 | 97 | # Print demo plots for trios. 98 | sanzo.demo3() 99 | 100 | # Print demo plots for quads. 101 | sanzo.demo4() 102 | 103 | # Print demo plots for all palettes. 104 | sanzo.demo.all() 105 | 106 | ``` 107 | 108 | The output of ```sanzo.demo2()```, ```sanzo.demo3()```, ```sanzo.demo4()```, and ```sanzo.demo.all()``` can be previewed at https://github.com/jmaasch/sanzo. 109 | 110 | ## Use with ```ggplot2```. 111 | 112 | View examples of use with ```ggplot2``` at https://github.com/jmaasch/sanzo. 113 | 114 | ## Use with base R. 115 | 116 | These examples use data from the ```datasets``` package and should be replicable. 117 | 118 | ### Scatter plot. 119 | 120 | ```{r base} 121 | 122 | graphics::plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 123 | main = "Combination 121", ylab = "", xlab = "", 124 | col = sanzo.trio("c121") [unclass(iris$Species)]) 125 | 126 | ``` 127 | 128 | ### Bar plot. 129 | 130 | ```{r base2} 131 | 132 | graphics::barplot(BOD$demand, col = sanzo.trio("c239"), 133 | main = "Combination 239", ylim = c(0, 20), border = NA) 134 | 135 | ``` 136 | -------------------------------------------------------------------------------- /.Rhistory: -------------------------------------------------------------------------------- 1 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 2 | library("mongolite") 3 | install.packages(c("RSQLite", "sofa", "etseed", "elastic", "mongolite", "redux", "reshape2", "dplyr", "DBI", "RMongo")) 4 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 5 | library("mongolite") 6 | library("RSQLite") # Used to connect to SQLite database 7 | library("RMongo") 8 | library("mongolite") 9 | library("RSQLite") # Used to connect to SQLite database 10 | library("DBI") 11 | library("dplyr") 12 | library("reshape2") 13 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 14 | View(con) 15 | if(con$count() > 0) con$drop() 16 | con$insert(mtcars) 17 | stopifnot(con$count() == nrow(mtcars)) 18 | con$insert(mtcars) 19 | mydata <- con$find() 20 | m <- mongo(collection = "nycflights") 21 | m <- "" 22 | m$insert(mtcars) 23 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 24 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 25 | con$insert(cars) 26 | cars <- con$insert(cars) 27 | View(cars) 28 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 29 | con <- con$insert(cars) 30 | cars 31 | cars$nInserted 32 | View(cars) 33 | cars$nInserted 34 | cars$nMatched 35 | mongo_data$distinct("carrier") 36 | View(mydata) 37 | x <- dbGetQuery(con,"select * from mpg") 38 | m <- mongo(collection="flightfact_mongodb",db="nycflights13") 39 | x <- dbGetQuery(mtcars ,"select * from mpg") 40 | head(mtcars) 41 | test <- mongo() 42 | mongo.collection <- mongo(collection = "HouseData") 43 | mongo.collection$insert(mydata) 44 | mongo.collection <- mongo(collection = "HouseData") 45 | mongo.collection$insert(mtcars) 46 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 47 | cars <- con$insert(cars) 48 | cars <- con$insert(cars) 49 | mongo_data <- mongo(collection = "mydata") 50 | mongo_data <- mongo(collection = mydata) 51 | library(nycflights13) 52 | mongo_data <- mongo(collection = nycflights) 53 | mongo_data <- mongo(collection = mydata) 54 | mongo.collection <- mongo(collection = "HouseData") 55 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 56 | cars <- con$insert(cars) 57 | con$insert(cars) 58 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 59 | cars <- con$insert(cars) 60 | if(con$count() > 0) con$drop() 61 | con$insert(mtcars) 62 | stopifnot(con$count() == nrow(mtcars)) 63 | mydata <- con$find() 64 | mt_cars_mongo <- con$find() 65 | stopifnot(all.equal(mydata, mtcars)) 66 | con$drop() 67 | View(mydata) 68 | View(mt_cars_mongo) 69 | stopifnot(all.equal(mydata, mtcars)) 70 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 71 | con 72 | head(con) 73 | #Display the data as it was read 74 | cars 75 | cars <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 76 | cars 77 | cars <- cars$insert(cars) 78 | cars_mongo <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 79 | #Display the data as it was read 80 | cars_mongo 81 | cars <- cars_mongo$insert(cars) 82 | if(cars$count() > 0) con$drop() 83 | #Create a data frame from the mongo lite data of mtcars 84 | mt_cars_mongo <- cars$find() 85 | if(cars$count() > 0) con$drop() 86 | if(cars$count() > 0) cars$drop() 87 | cars <- cars_mongo$insert(cars) 88 | cars_mongo <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 89 | #Display the data as it was read 90 | cars_mongo 91 | cars <- cars_mongo$insert(cars) 92 | if(cars$count() > 0) cars$drop() 93 | cars$insert(mtcars) 94 | stopifnot(cars$count() == nrow(mtcars)) 95 | cars <- cars_mongo$insert(cars) 96 | cars_mongo <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 97 | #Display the data as it was read 98 | cars_mongo 99 | cars <- cars_mongo$insert(cars) 100 | if(cars$count() > 0) cars$drop() 101 | mt_cars_mongo <- cars$find() 102 | cars_mongo <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 103 | if(cars$count() > 0) cars$drop() 104 | #Display the data as it was read 105 | cars_mongo 106 | #Create a data frame from the mongo lite data of mtcars 107 | mt_cars_mongo <- cars$find() 108 | # Connect to demo server 109 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") if(con$count() > 0) con$drop() 110 | # Connect to demo server 111 | con <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 112 | if(con$count() > 0) con$drop() 113 | con$insert(mtcars) 114 | stopifnot(con$count() == nrow(mtcars)) 115 | # Query data 116 | mydata <- con$find() 117 | stopifnot(all.equal(mydata, mtcars)) 118 | con$drop() 119 | # Connect to demo server 120 | cardata <- mongo("mtcars", url = "mongodb://readwrite:test@mongo.opencpu.org:43942/jeroen_test") 121 | if(cardata$count() > 0) cardata$drop() 122 | cardata$insert(mtcars) 123 | stopifnot(cardata$count() == nrow(mtcars)) 124 | # Query data 125 | mydata <- cardata$find() 126 | stopifnot(all.equal(mydata, mtcars)) 127 | cardata$drop() 128 | cardata 129 | head(mydata) 130 | install.packages("ggthemes", repos = "http://cran.cnr.berkeley.edu") 131 | install.packages("ggthemes", repos = "http://cran.cnr.berkeley.edu") 132 | install.packages("ggthemes") 133 | library(rlang) 134 | library(purrr) 135 | library(devtools) 136 | library(roxygen2) 137 | library(testthat) 138 | library(knitr) 139 | #### DEV SANZO #### 140 | # Load packages for package dev. 141 | library(devtools) 142 | library(roxygen2) 143 | library(testthat) 144 | library(knitr) 145 | library(rlang) 146 | library(purrr) 147 | #install.packages(c("rlang", "purrr")) 148 | #install.packages(c("devtools", "roxygen2", "testthat", "knitr")) 149 | devtools::create("myfirstpackage") 150 | devtools::create("sanzo") 151 | install.packages("lodown") 152 | library("lodown") 153 | devtools::install_github("jmaasch/sanzo") 154 | ?"::" 155 | knit_with_parameters('~/Desktop/PROGS/R_practice/sanzo/vignettes/sanzo_vignette.Rmd') 156 | version 157 | version 158 | install.packages("devtools") 159 | install.packages("knitr") 160 | install.packages("rmarkdown") 161 | setwd("/Users/razel/Desktop/PROGS/R_practice/sanzo") 162 | devtools::release() 163 | devtools::spell_check() 164 | usethis::spell_check() 165 | install.packages("spelling") 166 | devtools::spell_check() 167 | devtools::release() 168 | devtools::check_rhub() 169 | devtools::release() 170 | devtools::release() 171 | devtools::check() 172 | devtools::release() 173 | devtools::check() 174 | devtools::check() 175 | devtools::release() 176 | devtools::release() 177 | library(sanzo) 178 | sanzo.demo.all() 179 | devtools::install_github("jmaasch/sanzo") 180 | library(sanzo) 181 | sanzo.demo.all() 182 | -------------------------------------------------------------------------------- /dev/vignette_draft.rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Vignette" 3 | author: "Jacqueline R.M.A. Maasch" 4 | output: rmarkdown::html_vignette 5 | vignette: > 6 | %\VignetteIndexEntry{sanzo_vignette} 7 | %\VignetteEngine{knitr::rmarkdown} 8 | %\VignetteEncoding{UTF-8} 9 | --- 10 | 11 | 12 | # ```sanzo```: Color Palettes Based on the Works of Sanzo Wada 13 | 14 | An R package by JRMA Maasch (2019). 15 | 16 | This vignette is intended to share function documentation and code for several different use cases for this package. Find more information about this package at https://github.com/jmaasch/sanzo. 17 | 18 | ```{r hide, include = FALSE} 19 | 20 | # Read in data for ggplot2 demos. 21 | raw <- read.csv("/Users/razel/Desktop/PROGS/R_practice/2019/sth_plasmid_ct_mean_raw.csv") 22 | mean <- read.csv("/Users/razel/Desktop/PROGS/R_practice/2019/sth_plasmid_ct_mean.csv") 23 | 24 | ``` 25 | 26 | ## Load packages 27 | 28 | ```{r setup, warning = FALSE, error = FALSE} 29 | # Install package if needed. 30 | # devtools::install_github("jmaasch/sanzo") 31 | 32 | # Load sanzo. 33 | library(sanzo) 34 | 35 | # Load packages for ggplot2 demos. 36 | library(ggplot2) 37 | library(ggthemes) 38 | 39 | ``` 40 | 41 | ## Functions. 42 | * ```sanzo.duo(palette_name)``` : return duo palette 43 | * ```sanzo.trio(palette_name)``` : return trio palette 44 | * ```sanzo.quad(palette_name)``` : return quad palette 45 | * ```sanzo.demo2()``` : print demo plots for all duo palettes 46 | * ```sanzo.demo3()``` : print demo plots for all trio palettes 47 | * ```sanzo.demo4()``` : print demo plots for all quad palettes 48 | * ```sanzo.demo.all()``` : print demo plots for all palettes 49 | * ```sanzo.info2()``` : return data frame of hexadecimals and urls for all duo palettes 50 | * ```sanzo.info3()``` : return data frame of hexadecimals and urls for all trio palettes 51 | * ```sanzo.info4()``` : return data frame of hexadecimals and urls for all quad palettes 52 | * ```sanzo.info.all()``` : return data frame of hexadecimals and urls for all palettes 53 | 54 | ## View function documentation. 55 | 56 | Precede any function by a question mark to access description, arguments, return value, and usage suggestions. 57 | 58 | ```{r doc} 59 | 60 | # Examples: 61 | ?sanzo.info2() 62 | ?sanzo.trio() 63 | 64 | ``` 65 | 66 | ## View metadata for all duos, trios, and quads. 67 | 68 | To quickly access palette names: 69 | 70 | ```{r names} 71 | 72 | names(duos) 73 | names(trios) 74 | names(quads) 75 | 76 | ``` 77 | 78 | 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. 79 | 80 | ```{r info} 81 | 82 | knitr::kable(sanzo.info2()) 83 | knitr::kable(sanzo.info3()) 84 | knitr::kable(sanzo.info4()) 85 | 86 | ``` 87 | 88 | 89 | ## View palette demos. 90 | 91 | To illustrate their potential, each color combination can be demo'd via base R scatter and bar plots. The output of ```sanzo.demo2()```, ```sanzo.demo3()```, ```sanzo.demo4()```, and ```sanzo.demo.all()``` can be previewed at https://github.com/jmaasch/sanzo. 92 | 93 | ## Use with base R. 94 | 95 | These examples use data from the ```datasets``` package and should be replicable. 96 | 97 | ### Scatter plot. 98 | 99 | ```{r base} 100 | 101 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, main = "Combination 121", 102 | ylab = "", xlab = "", col = sanzo.trio("c121") [unclass(iris$Species)]) 103 | 104 | ``` 105 | 106 | ### Bar plot. 107 | 108 | ```{r base2} 109 | barplot(BOD$demand, col = sanzo.trio("c139"), main = "Combination 139", 110 | ylim = c(0, 20), border = NA) 111 | ``` 112 | 113 | ## Use with ```ggplot2``` and the ```ggthemes``` extension. 114 | 115 | ### Violin plot. 116 | 117 | ```{r violin_data, echo = FALSE} 118 | x1 <- rnorm(40, mean = 80.2, sd = 4) 119 | x2 <- rnorm(20, mean = 75.3, sd = 5) 120 | x3 <- rnorm(30, mean = 63.3, sd = 4) 121 | x4 <- rnorm(20, mean = 55.8, sd = 3) 122 | 123 | y1 <- rnorm(40, mean = 55.8, sd = 3) 124 | y2 <- rnorm(20, mean = 63.3, sd = 4) 125 | y3 <- rnorm(30, mean = 55.8, sd = 5) 126 | y4 <- rnorm(20, mean = 80.2, sd = 4) 127 | 128 | x <- c(x1, x2, x3, x4) 129 | y <- c(y1, y2, y3, y4) 130 | 131 | category <- c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 132 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 133 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 134 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 135 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 136 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4) 137 | 138 | df_scatter <- data.frame(x, y, category) 139 | 140 | ``` 141 | 142 | ```{r violin, warning = FALSE} 143 | 144 | ggplot(df_scatter, aes(category, x), color = as.factor(category)) + 145 | geom_violin(aes(fill = factor(category)), trim = FALSE) + 146 | theme_hc() + 147 | scale_fill_manual(name = "", 148 | values = sanzo.quad("c279")) + 149 | theme(axis.text = element_text(size = 8), 150 | axis.title = element_text(size = 10), 151 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 152 | legend.position = "none") + 153 | labs(y = "", 154 | x = "", 155 | fill = "", 156 | title = "Combination 279\n") + 157 | theme(aspect.ratio = 1) 158 | ``` 159 | 160 | ### Use as gradient. 161 | 162 | By default, ```sanzo``` palettes are discrete. There are multiple ways to achieve a gradient. For example, using ```scale_fill_gradientn``` or ```scale_color_gradientn``` in ```ggplot2``` allows you to use any ```sanzo``` palette as a continuous gradient. 163 | 164 | This example uses data from the ```datasets``` package and should be replicable. Continuous colors via ```scale_fill_gradientn``` and plot theme via ```theme_few``` from the ```ggthemes``` extension. 165 | 166 | ```{r gradient, warning = FALSE} 167 | 168 | ggplot(faithfuld, aes(waiting, eruptions)) + 169 | geom_raster(aes(fill = density), interpolate = TRUE) + 170 | theme_few() + 171 | scale_fill_gradientn(colors = sanzo.trio("c226")) + 172 | labs(y = "", 173 | x = "", 174 | fill = "", 175 | title = "Combination 226\n") 176 | 177 | ``` 178 | 179 | ### Bar plot. 180 | 181 | ```{r stacked_bar, warning = FALSE} 182 | 183 | ggplot(mean, aes(fill = Concentration, y = CT, x = Target)) + 184 | geom_bar(stat = "identity") + 185 | theme_few() + 186 | scale_fill_manual(values = sanzo.trio("c239"), labels = c("A", "B", "C")) + 187 | theme(axis.text = element_text(size = 8), 188 | axis.title = element_text(size = 10), 189 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 190 | legend.title = element_text(size = 10), 191 | legend.position = "bottom", 192 | legend.direction = "horizontal") + 193 | scale_x_discrete(labels = c("1", "2", "3")) + 194 | labs(y = "", 195 | x = "", 196 | fill = "", 197 | title = "Combination 239") 198 | 199 | ``` 200 | -------------------------------------------------------------------------------- /R/info.R: -------------------------------------------------------------------------------- 1 | #' See metadata for all duo palettes 2 | #' 3 | #' Create data frame containing long-form names, short-form IDs, 4 | #' hexadecimal values, and links to Dain M. Blodorn Kim's 5 | #' https://sanzo-wada.dmbk.io for all duo palettes. 6 | #' 7 | #' @return Return data frame containing long-form names, short-form IDs, 8 | #' hex values, and URLs for all duos. 9 | #' 10 | #' @examples 11 | #' duo_info_df <- sanzo.info2() 12 | #' print(sanzo.info2()) 13 | #' 14 | #' @export 15 | #' 16 | sanzo.info2 <- function() { 17 | 18 | long_names <- c("Combination 6", "Combination 7", "Combination 8", "Combination 33", 19 | "Combination 35", "Combination 47", "Combination 70", "Combination 71", 20 | "Combination 74", "Combination 79", "Combination 85", "Combination 91", 21 | "Combination 95", "Combination 102", "Combination 103", "Combination 106", 22 | "Combination 114", "Combination 118", "Combination 119", "Combination 229") 23 | short_names <- c("c006", "c007", "c008", "c033", "c035", "c047", "c070", "c071", "c074", "c079", 24 | "c085", "c091", "c095", "c102", "c103", "c106", "c114", "c118", "c119", "c229") 25 | hex <- c("#ff616b, #000831", "#ff5200, #b3e8c2", "#c2612c, #b8b8ff", "#b85e00, #1b3644", 26 | "#b08699, #a10b2b", "#c9303e, #bfabcc", "#b85e00, #405416", "#a90636, #d99e73", 27 | "#b5ffc2, #2dbc94", "#651300, #2dbc94", "#c74300, #008aa1", "#5c2c45, #c05200", 28 | "#681916, #06004f", "#ebd999, #c05200", "#c2612c, #2d0060", "#008aa1, #06004f", 29 | "#ffab00, #008aa1", "#e0b81f, #362304", "#a6e6db, #0d2b52", "#172713, #b5d1cc") 30 | url <- c("https://sanzo-wada.dmbk.io/combination/6", "https://sanzo-wada.dmbk.io/combination/7", 31 | "https://sanzo-wada.dmbk.io/combination/8", "https://sanzo-wada.dmbk.io/combination/33", 32 | "https://sanzo-wada.dmbk.io/combination/35", "https://sanzo-wada.dmbk.io/combination/47", 33 | "https://sanzo-wada.dmbk.io/combination/70", "https://sanzo-wada.dmbk.io/combination/71", 34 | "https://sanzo-wada.dmbk.io/combination/74", "https://sanzo-wada.dmbk.io/combination/79", 35 | "https://sanzo-wada.dmbk.io/combination/85", "https://sanzo-wada.dmbk.io/combination/91", 36 | "https://sanzo-wada.dmbk.io/combination/95", "https://sanzo-wada.dmbk.io/combination/102", 37 | "https://sanzo-wada.dmbk.io/combination/103", "https://sanzo-wada.dmbk.io/combination/106", 38 | "https://sanzo-wada.dmbk.io/combination/114", "https://sanzo-wada.dmbk.io/combination/118", 39 | "https://sanzo-wada.dmbk.io/combination/119", "https://sanzo-wada.dmbk.io/combination/229") 40 | 41 | df <- data.frame(long_names, short_names, hex, url) 42 | colnames(df) <- c("DUO PALETTE", "ID", "HEX VALUES", "URL") 43 | return(df) 44 | 45 | } 46 | 47 | #' See metadata for all trio palettes 48 | #' 49 | #' Create data frame containing long-form names, short-form IDs, 50 | #' hexadecimal values, and links to Dain M. Blodorn Kim's 51 | #' https://sanzo-wada.dmbk.io for all trio palettes. 52 | #' 53 | #' @return Return data frame containing long-form names, short-form IDs, 54 | #' hex values, and URLs for all trios. 55 | #' 56 | #' @examples 57 | #' trio_info_df <- sanzo.info3() 58 | #' print(sanzo.info3()) 59 | #' 60 | #' @export 61 | #' 62 | sanzo.info3 <- function() { 63 | 64 | long_names <- c("Combination 121", "Combination 139", "Combination 142", "Combination 148", 65 | "Combination 149", "Combination 157", "Combination 163", "Combination 171", 66 | "Combination 172", "Combination 174", "Combination 194", "Combination 204", 67 | "Combination 205", "Combination 207", "Combination 223", "Combination 226", 68 | "Combination 232", "Combination 239", "Combination 240", "Combination 343") 69 | short_names <- c("c121", "c139", "c142", "c148", "c149", "c157", "c163", "c171", "c172", "c174", 70 | "c194", "c204", "c205", "c207", "c223", "c226", "c232", "c239", "c240", "c343") 71 | hex <- c("#6c2b11, #d99e73, #405416", "#96bfe6, #000831, #b5d1cc", "#9e194d, #baa600, #96bfe6", 72 | "#d1bd19, #ffab00, #29bdad", "#d1bd19, #ff5200, #0f261f", "#6f0043, #d1bd19, #4f8fe6", 73 | "#ffe600, #b5ffc2, #008aa1", "#730f1f, #ff8c00, #b3e8c2", "#c2612c, #008aa1, #3400a3", 74 | "#ffa6d9, #bfabcc, #6b2e63", "#fa2b00, #ffcfc4, #4f8fe6", "#b319ab, #c2612c, #a6e6db", 75 | "#730f1f, #f59994, #2619d1", "#9b5348, #b3e8c2, #000000", "#b08699, #d99e73, #b5ffc2", 76 | "#5c2c45, #ffb852, #2619d1", "#d60036, #f2ad78, #000831", "#b08699, #c4bf33, #b3e8c2", 77 | "#ff788c, #ffff00, #29bdad", "#a93400, #ebd999, #505423") 78 | url <- c("https://sanzo-wada.dmbk.io/combination/121", "https://sanzo-wada.dmbk.io/combination/139", 79 | "https://sanzo-wada.dmbk.io/combination/142", "https://sanzo-wada.dmbk.io/combination/148", 80 | "https://sanzo-wada.dmbk.io/combination/149", "https://sanzo-wada.dmbk.io/combination/157", 81 | "https://sanzo-wada.dmbk.io/combination/163", "https://sanzo-wada.dmbk.io/combination/171", 82 | "https://sanzo-wada.dmbk.io/combination/172", "https://sanzo-wada.dmbk.io/combination/174", 83 | "https://sanzo-wada.dmbk.io/combination/194", "https://sanzo-wada.dmbk.io/combination/204", 84 | "https://sanzo-wada.dmbk.io/combination/205", "https://sanzo-wada.dmbk.io/combination/207", 85 | "https://sanzo-wada.dmbk.io/combination/223", "https://sanzo-wada.dmbk.io/combination/226", 86 | "https://sanzo-wada.dmbk.io/combination/232", "https://sanzo-wada.dmbk.io/combination/239", 87 | "https://sanzo-wada.dmbk.io/combination/240", "https://sanzo-wada.dmbk.io/combination/343") 88 | 89 | df <- data.frame(long_names, short_names, hex, url) 90 | colnames(df) <- c("TRIO PALETTE", "ID", "HEX VALUES", "URL") 91 | return(df) 92 | 93 | } 94 | 95 | #' See metadata for all quad palettes 96 | #' 97 | #' Create data frame containing long-form names, short-form IDs, 98 | #' hexadecimal values, and links to Dain M. Blodorn Kim's 99 | #' https://sanzo-wada.dmbk.io for all quad palettes. 100 | #' 101 | #' @return Return data frame containing long-form names, short-form IDs, 102 | #' hex values, and URLs for all quads 103 | #' 104 | #' @examples 105 | #' quad_info_df <- sanzo.info4() 106 | #' print(sanzo.info4()) 107 | #' 108 | #' @export 109 | #' 110 | sanzo.info4 <- function() { 111 | 112 | long_names <- c("Combination 249", "Combination 252", "Combination 263", "Combination 268", 113 | "Combination 271", "Combination 273", "Combination 279", "Combination 283", 114 | "Combination 289", "Combination 293", "Combination 296", "Combination 302", 115 | "Combination 310", "Combination 321", "Combination 329", "Combination 330", 116 | "Combination 332", "Combination 339", "Combination 341", "Combination 348") 117 | short_names <- c("c249", "c252", "c263", "c268", "c271", "c273", "c279", "c283", "c289", "c293", 118 | "c296", "c302", "c310", "c321", "c329", "c330", "c332", "c339", "c341", "c348") 119 | hex <- c("#681916, #c0b490, #d1bd19, #417777", "#e62e73, #b85e00, #baa600, #2dbc94", 120 | "#a93400, #f2ad78, #b5ffc2, #1b3644", "#b08699, #b85e00, #172713, #bfffe6", 121 | "#b90078, #94ff94, #2dbc94, #0f261f", "#ffb3f0, #6f0043, #9b5348, #b5d1cc", 122 | "#b85e00, #f59994, #c0b490, #0d2b52", "#a7374b, #730f1f, #85b857, #6bffb3", 123 | "#f2ff26, #bdf226, #202d85, #06004f", "#b85e00, #b5ffc2, #65a98f, #40c945", 124 | "#f5f5b8, #d99e73, #5e4017, #1b3644", "#ffb852, #c0b490, #bfffe6, #008aa1", 125 | "#f5f5b8, #f2ad78, #718600, #172713", "#b08699, #f5f5b8, #172713, #96bfe6", 126 | "#ffb852, #bfabcc, #340059, #1b3644", "#bcd382, #bfffe6, #96bfe6, #2dbc94", 127 | "#ff7399, #d50c42, #172713, #00592e", "#d99e73, #de4500, #a6e6db, #202d85", 128 | "#ff616b, #328e13, #172713, #a6e6db", "#bcd382, #328e13, #172713, #340059") 129 | url <- c("https://sanzo-wada.dmbk.io/combination/249", "https://sanzo-wada.dmbk.io/combination/252", 130 | "https://sanzo-wada.dmbk.io/combination/263", "https://sanzo-wada.dmbk.io/combination/268", 131 | "https://sanzo-wada.dmbk.io/combination/271", "https://sanzo-wada.dmbk.io/combination/273", 132 | "https://sanzo-wada.dmbk.io/combination/279", "https://sanzo-wada.dmbk.io/combination/283", 133 | "https://sanzo-wada.dmbk.io/combination/289", "https://sanzo-wada.dmbk.io/combination/293", 134 | "https://sanzo-wada.dmbk.io/combination/296", "https://sanzo-wada.dmbk.io/combination/302", 135 | "https://sanzo-wada.dmbk.io/combination/310", "https://sanzo-wada.dmbk.io/combination/321", 136 | "https://sanzo-wada.dmbk.io/combination/329", "https://sanzo-wada.dmbk.io/combination/330", 137 | "https://sanzo-wada.dmbk.io/combination/332", "https://sanzo-wada.dmbk.io/combination/339", 138 | "https://sanzo-wada.dmbk.io/combination/341", "https://sanzo-wada.dmbk.io/combination/348") 139 | 140 | df <- data.frame(long_names, short_names, hex, url) 141 | colnames(df) <- c("QUAD PALETTE", "ID", "HEX VALUES", "URL") 142 | return(df) 143 | 144 | } 145 | 146 | #' See metadata for all palettes 147 | #' 148 | #' Create data frame containing long-form names, short-form IDs, 149 | #' hexadecimal values, and links to Dain M. Blodorn Kim's 150 | #' https://sanzo-wada.dmbk.io for all sanzo palettes. 151 | #' 152 | #' @return Return data frame containing long-form names, short-form IDs, 153 | #' hex values, and URLs for all sanzo palettes. 154 | #' 155 | #' @examples 156 | #' info_df <- sanzo.info.all() 157 | #' print(sanzo.info.all()) 158 | #' 159 | #' @export 160 | #' 161 | sanzo.info.all <- function() { 162 | 163 | d <- sanzo.info2() 164 | t <- sanzo.info3() 165 | q <- sanzo.info4() 166 | 167 | df <- merge(d, t, all = TRUE) 168 | df <- merge(df, q, all = TRUE) 169 | return(df) 170 | 171 | } 172 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ```sanzo``` 2 | 3 | # Color Palettes Based on the Works of Sanzo Wada 4 | An R package by JRMA Maasch (2019). View on CRAN. 5 | 6 |

7 | 8 | 9 |

10 | 11 | ### Table of contents 12 | 13 | 1. **[About](#about):** Origins and inspirations. 14 | 2. **[Usage](#usage):**   [Install.](#installation)   |   [Docs.](#view-documentation)   |   [Demo.](#view-palette-demos-using-sanzodemo-functions)   |   [Base R.](#use-with-base-R)   |   [ggplot2.](#use-with-ggplot2)   |   [Gradient.](#use-as-a-continuous-color-palette)   |   [Metadata.](#access-palette-metadata-with-sanzoinfo-functions)   |   [Customize.](#customize) 15 | 3. **[ggplot2 gallery](#ggplot2-gallery):**   [Scatter plots.](#scatter-plots)   | [  Bar plots.](#bar-plots)   |   [Violin plots.](#violin-plots)   |   [2D Density plots.](#2D-Density-plots)   16 | 4. **[View full suite](#view-full-suite):**   [Duo palettes.](#duo-palettes)   |   [Trio palettes.](#trio-palettes)   |   [Quad palettes.](#quad-palettes) 17 | 18 | # About 19 | 20 | Inspired by the art and color research of Sanzo Wada, his Dictionary Of Color Combinations, and the incredible interactive site by Dain M. Blodorn Kim, this package brings Wada's color combinations to R for easy use in data visualizations. This package honors 60 of Wada's color combinations: 20 duos, 20 trios, and 20 quads. 21 | 22 | > Sanzo Wada (1883-1967) was an artist, teacher, costume and kimono designer during a turbulent time in avant-garde Japanese art and cinema. Wada was ahead of his time in developing traditional and Western influenced color combinations, helping to lay the foundations for contemporary color research. Based on his original 6-volume work from the 1930s, this book offers 348 color combinations with CMYK and Pantone numbers, as attractive and sensuous as the book’s own design. – *A Dictionary Of Color Combinations* 23 | 24 |

25 | 26 |

27 | 28 | This package is licensed under the GNU General Public License v3.0 (GPL-3). 29 | 30 | ↑ [return to top](#sanzo) 31 | 32 | # Usage 33 | 34 | ### Installation. 35 | 36 | ```R 37 | # Install from CRAN (recommended). 38 | install.packages("sanzo") 39 | 40 | # Alternatively, install development version. 41 | # Note: the package devtools must be installed but need not be loaded. 42 | devtools::install_github("jmaasch/sanzo") 43 | 44 | # Load package. 45 | library(sanzo) 46 | ``` 47 | 48 | ### View documentation. 49 | 50 | View this vignette for additional package documentation, or precede any function by a question mark to access description, arguments, return value, and usage suggestions. 51 | 52 | ```R 53 | # Access function documentation. 54 | ?sanzo.info2() 55 | ?sanzo.trio() 56 | ``` 57 | 58 | ### View palette demos using ```sanzo.demo*``` functions. 59 | 60 | Each color combination can be demo'd via base R scatter and bar plots. To view the output of these functions, see 61 | **[Full suite](#full-suite):** [Duo palettes.](#duo-palettes) | [Trio palettes.](#trio-palettes) | [Quad palettes.](#quad-palettes) 62 | 63 | ```R 64 | 65 | # Print demo plots for duos. 66 | sanzo.demo2() 67 | 68 | # Print demo plots for trios. 69 | sanzo.demo3() 70 | 71 | # Print demo plots for quads. 72 | sanzo.demo4() 73 | 74 | # Print demo plots for all palettes. 75 | sanzo.demo.all() 76 | ``` 77 | 78 | *Optional*: for easier viewing, try gridding up prior to running ```sanzo.demo*``` functions. **NOTE:** This will alter ```par``` settings. 79 | 80 | ```R 81 | 82 | # Set up gridded layout, if desired: 83 | graphics::layout(matrix(1:4, nrow = 2)) 84 | graphics::par(mar = c(2, 2, 2, 2)) 85 | 86 | ``` 87 | 88 | ### Use with base R. 89 | 90 | All examples use data from the ```datasets``` package and should be replicable. 91 | 92 | ```R 93 | # Assign palette to a name if desired. 94 | my_duo <- sanzo.duo("c229") 95 | my_trio <- sanzo.trio("c223") 96 | my_quad <- sanzo.quad("c252") 97 | 98 | # Use palette that has been assigned to a name. 99 | plot(iris$Sepal.Length, iris$Sepal.Width, col = my_quad) 100 | 101 | # Use directly. 102 | plot(iris$Sepal.Length, iris$Sepal.Width, col = sanzo.duo("c085")) 103 | ``` 104 | 105 | ### Use with ```ggplot2```. 106 | 107 | Use with ```scale_fill_manual``` or ```scale_color_manual```. All examples use data from the ```datasets``` package and should be replicable. 108 | 109 | ```R 110 | ggplot(iris, aes(fill = Species, y = Sepal.Width, x = Sepal.Length)) + 111 | geom_bar(stat = "identity") + 112 | scale_fill_manual(values = sanzo.trio("c223")) 113 | ``` 114 | 115 | ### Use as a continuous color palette. 116 | 117 | By default, ```sanzo``` palettes are discrete. There are multiple ways to achieve a gradient. For example, using ```scale_fill_gradientn``` or ```scale_color_gradientn``` in ```ggplot2``` allows you to use any ```sanzo``` palette as a continuous gradient. See example visualizations [here.](#gradient) 118 | 119 | ```R 120 | ggplot(faithfuld, aes(waiting, eruptions)) + 121 | geom_raster(aes(fill = density), interpolate = TRUE) + 122 | scale_fill_gradientn(colors = sanzo.duo("c102")) 123 | ``` 124 | 125 | ### Access palette metadata with ```sanzo.info*``` functions. 126 | 127 | These 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 information. 128 | 129 | ```R 130 | duo_info_df <- sanzo.info2() 131 | 132 | trio_info_df <- sanzo.info3() 133 | 134 | quad_info_df <- sanzo.info4() 135 | 136 | info_df <- sanzo.info.all() 137 | 138 | # Two ways to print a data frame. 139 | print(sanzo.info2()) 140 | knitr::kable(sanzo.info2()) 141 | ``` 142 | 143 | Duo, trio, and quad data are stored in exported lists. To quickly access palette names or hexadecimals only: 144 | 145 | ```R 146 | # Access palette names. 147 | names(duos) 148 | names(trios) 149 | names(quads) 150 | 151 | # Print hex values for a given palette to the console. 152 | # Example output = [1] "#ff616b" "#000831" 153 | sanzo.duo("c006") 154 | ``` 155 | 156 | 157 | 158 | ### Customize. 159 | 160 | Concatenate multiple palettes to make a custom palette or cherry-pick individual colors. All hexadecimals are provided by the ```sanzo.demo*``` functions and ```sanzo.info*``` functions. 161 | 162 | ```R 163 | c033 <- sanzo.duo("c033") 164 | c095 <- sanzo.duo("c095") 165 | custom_quad <- c(c033, c095) 166 | ``` 167 | 168 | For a more muted color palette, select an alpha less than 1. In the plot at right, ```alpha = 5/6```. 169 | 170 | ↑ [return to top](#sanzo) 171 | 172 | ## ```ggplot2``` gallery 173 | 174 | Many of the plots in this gallery additionally use the ```ggthemes``` and ```cowplot``` packages. 175 | 176 | ### Scatter plots. 177 | 178 | | | | 179 | |:-------------------------:|:-------------------------:| 180 | |**Combination 205, ```alpha = 3/4.```**|**Combination 194, ```alpha = 3/4.```**| 181 | |![scatter1](https://github.com/jmaasch/sanzo/blob/master/dev/ggplot2demos/scatter1.png)|![scatter2](https://github.com/jmaasch/sanzo/blob/master/dev/ggplot2demos/scatter2.png)| 182 | |**Combination 121, ```alpha = 3/4.```**|**Combination 172, ```alpha = 3/4.```**| 183 | |![scatter3](https://github.com/jmaasch/sanzo/blob/master/dev/ggplot2demos/scatter3.png)|![scatter4](https://github.com/jmaasch/sanzo/blob/master/dev/ggplot2demos/scatter5.png)| 184 | 185 | ### Violin plots. 186 | 187 |

188 | 189 |

190 | 191 | ### Bar plots. 192 | 193 | | | | 194 | |:-------------------------:|:-------------------------:| 195 | |![bar1](https://github.com/jmaasch/sanzo/blob/master/dev/ggplot2demos/bar_ggplot2.png)|![bar2](https://github.com/jmaasch/sanzo/blob/master/dev/ggplot2demos/bar_stacked_ggplot2.png)| 196 | 197 | ### 2D Density plots. 198 | 199 | 200 | 201 | See how to use ```sanzo``` color combinations as continuous palettes [here.](#use-as-a-continuous-color-palette) 202 | 203 | ↑ [return to top](#sanzo) 204 | 205 | # View full suite 206 | 207 | ### Duo palettes. 208 | 209 | | | | 210 | |:-------------------------:|:-------------------------:| 211 | |![demo1](https://github.com/jmaasch/sanzo/blob/master/dev/demos2/Unknown-1.png)|![demo2](https://github.com/jmaasch/sanzo/blob/master/dev/demos2/Unknown-2.png)| 212 | |![demo3](https://github.com/jmaasch/sanzo/blob/master/dev/demos2/Unknown-3.png)|![demo4](https://github.com/jmaasch/sanzo/blob/master/dev/demos2/Unknown-4.png)| 213 | |![demo5](https://github.com/jmaasch/sanzo/blob/master/dev/demos2/Unknown-5.png)|![demo6](https://github.com/jmaasch/sanzo/blob/master/dev/demos2/Unknown-6.png)| 214 | |![demo7](https://github.com/jmaasch/sanzo/blob/master/dev/demos2/Unknown-7.png)|![demo8](https://github.com/jmaasch/sanzo/blob/master/dev/demos2/Unknown-8.png)| 215 | |![demo9](https://github.com/jmaasch/sanzo/blob/master/dev/demos2/Unknown-9.png)|![demo10](https://github.com/jmaasch/sanzo/blob/master/dev/demos2/Unknown-10.png)| 216 | 217 | ↑ [return to top](#sanzo) 218 | 219 | ### Trio palettes. 220 | 221 | | | | 222 | |:-------------------------:|:-------------------------:| 223 | |![demo1](https://github.com/jmaasch/sanzo/blob/master/dev/demos3/Unknown-1.png)|![demo2](https://github.com/jmaasch/sanzo/blob/master/dev/demos3/Unknown-2.png)| 224 | |![demo3](https://github.com/jmaasch/sanzo/blob/master/dev/demos3/Unknown-3.png)|![demo4](https://github.com/jmaasch/sanzo/blob/master/dev/demos3/Unknown-4.png)| 225 | |![demo5](https://github.com/jmaasch/sanzo/blob/master/dev/demos3/Unknown-5.png)|![demo6](https://github.com/jmaasch/sanzo/blob/master/dev/demos3/Unknown-6.png)| 226 | |![demo7](https://github.com/jmaasch/sanzo/blob/master/dev/demos3/Unknown-7.png)|![demo8](https://github.com/jmaasch/sanzo/blob/master/dev/demos3/Unknown-8.png)| 227 | |![demo9](https://github.com/jmaasch/sanzo/blob/master/dev/demos3/Unknown-9.png)|![demo10](https://github.com/jmaasch/sanzo/blob/master/dev/demos3/Unknown-10.png)| 228 | 229 | ↑ [return to top](#sanzo) 230 | 231 | ### Quad palettes. 232 | 233 | | | | 234 | |:-------------------------:|:-------------------------:| 235 | |![demo1](https://github.com/jmaasch/sanzo/blob/master/dev/demos4/Unknown-1.png)|![demo2](https://github.com/jmaasch/sanzo/blob/master/dev/demos4/Unknown-2.png)| 236 | |![demo3](https://github.com/jmaasch/sanzo/blob/master/dev/demos4/Unknown-3.png)|![demo4](https://github.com/jmaasch/sanzo/blob/master/dev/demos4/Unknown-4.png)| 237 | |![demo5](https://github.com/jmaasch/sanzo/blob/master/dev/demos4/Unknown-5.png)|![demo6](https://github.com/jmaasch/sanzo/blob/master/dev/demos4/Unknown-6.png)| 238 | |![demo7](https://github.com/jmaasch/sanzo/blob/master/dev/demos4/Unknown-7.png)|![demo8](https://github.com/jmaasch/sanzo/blob/master/dev/demos4/Unknown-8.png)| 239 | |![demo9](https://github.com/jmaasch/sanzo/blob/master/dev/demos4/Unknown-9.png)|![demo10](https://github.com/jmaasch/sanzo/blob/master/dev/demos4/Unknown-10.png)| 240 | 241 | ↑ [return to top](#sanzo) 242 | -------------------------------------------------------------------------------- /R/demo.R: -------------------------------------------------------------------------------- 1 | #' Print demo plots for all duo palettes 2 | #' 3 | #' Print demo base R plots for all 20 duo palettes to illustrate 4 | #' their use and display hexadecimal values. 5 | #' 6 | #' @examples 7 | #' sanzo.demo2() 8 | #' 9 | #' @export 10 | #' 11 | sanzo.demo2 <- function() { 12 | 13 | # Check that required packages are installed. 14 | 15 | if (!requireNamespace("datasets", quietly = TRUE)) { 16 | stop("Package \"datasets\" required for function. Please install this package to proceed.", 17 | call. = FALSE) 18 | } 19 | else if (!requireNamespace("graphics", quietly = TRUE)) { 20 | stop("Package \"graphics\" required for function. Please install this package to proceed.", 21 | call. = FALSE) 22 | } 23 | else if (!requireNamespace("stats", quietly = TRUE)) { 24 | stop("Package \"stats\" required for function. Please install this package to proceed.", 25 | call. = FALSE) 26 | } 27 | 28 | # Print demo plots. 29 | 30 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c006"), main = "Combination 006", 31 | ylim = c(0, 20), border = NA) 32 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 33 | col = sanzo.duo("c006") [unclass(datasets::iris$Species)], ann = FALSE) 34 | graphics::legend("top", legend = c("#ff616b", "#000831"), horiz = TRUE, xpd = TRUE, 35 | inset = c(-0.24), col = sanzo.duo("c006"), pch = 15, bty = "n") 36 | 37 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c007"), main = "Combination 007", 38 | ylim = c(0, 20), border = NA) 39 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 40 | col = sanzo.duo("c007") [unclass(datasets::iris$Species)], ann = FALSE) 41 | graphics::legend("top", legend = c("#ff5200", "#b3e8c2"), horiz = TRUE, xpd = TRUE, 42 | inset = c(-0.24), col = sanzo.duo("c007"), pch = 15, bty = "n") 43 | 44 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c008"), main = "Combination 008", 45 | ylim = c(0, 20), border = NA) 46 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 47 | col = sanzo.duo("c008") [unclass(datasets::iris$Species)], ann = FALSE) 48 | graphics::legend("top", legend = c("#c2612c", "#b8b8ff"), horiz = TRUE, xpd = TRUE, 49 | inset = c(-0.24), col = sanzo.duo("c008"), pch = 15, bty = "n") 50 | 51 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c033"), main = "Combination 033", 52 | ylim = c(0, 20), border = NA) 53 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 54 | col = sanzo.duo("c033") [unclass(datasets::iris$Species)], ann = FALSE) 55 | graphics::legend("top", legend = c("#b85e00", "#1b3644"), horiz = TRUE, xpd = TRUE, 56 | inset = c(-0.24), col = sanzo.duo("c033"), pch = 15, bty = "n") 57 | 58 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c035"), main = "Combination 035", 59 | ylim = c(0, 20), border = NA) 60 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 61 | col = sanzo.duo("c035") [unclass(datasets::iris$Species)], ann = FALSE) 62 | graphics::legend("top", legend = c("#b08699", "#a10b2b"), horiz = TRUE, xpd = TRUE, 63 | inset = c(-0.24), col = sanzo.duo("c035"), pch = 15, bty = "n") 64 | 65 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c047"), main = "Combination 047", 66 | ylim = c(0, 20), border = NA) 67 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 68 | col = sanzo.duo("c047") [unclass(datasets::iris$Species)], ann = FALSE) 69 | graphics::legend("top", legend = c("#c9303e", "#bfabcc"), horiz = TRUE, xpd = TRUE, 70 | inset = c(-0.24), col = sanzo.duo("c047"), pch = 15, bty = "n") 71 | 72 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c070"), main = "Combination 070", 73 | ylim = c(0, 20), border = NA) 74 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 75 | col = sanzo.duo("c070") [unclass(datasets::iris$Species)], ann = FALSE) 76 | graphics::legend("top", legend = c("#b85e00", "#405416"), horiz = TRUE, xpd = TRUE, 77 | inset = c(-0.24), col = sanzo.duo("c070"), pch = 15, bty = "n") 78 | 79 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c071"), main = "Combination 071", 80 | ylim = c(0, 20), border = NA) 81 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 82 | col = sanzo.duo("c071") [unclass(datasets::iris$Species)], ann = FALSE) 83 | graphics::legend("top", legend = c("#a90636", "#d99e73"), horiz = TRUE, xpd = TRUE, 84 | inset = c(-0.24), col = sanzo.duo("c071"), pch = 15, bty = "n") 85 | 86 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c074"), main = "Combination 074", 87 | ylim = c(0, 20), border = NA) 88 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 89 | col = sanzo.duo("c074") [unclass(datasets::iris$Species)], ann = FALSE) 90 | graphics::legend("top", legend = c("#b5ffc2", "#2dbc94"), horiz = TRUE, xpd = TRUE, 91 | inset = c(-0.24), col = sanzo.duo("c074"), pch = 15, bty = "n") 92 | 93 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c079"), main = "Combination 079", 94 | ylim = c(0, 20), border = NA) 95 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 96 | col = sanzo.duo("c079") [unclass(datasets::iris$Species)], ann = FALSE) 97 | graphics::legend("top", legend = c("#651300", "#2dbc94"), horiz = TRUE, xpd = TRUE, 98 | inset = c(-0.24), col = sanzo.duo("c079"), pch = 15, bty = "n") 99 | 100 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c085"), main = "Combination 085", 101 | ylim = c(0, 20), border = NA) 102 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 103 | col = sanzo.duo("c085") [unclass(datasets::iris$Species)], ann = FALSE) 104 | graphics::legend("top", legend = c("#c74300", "#008aa1"), horiz = TRUE, xpd = TRUE, 105 | inset = c(-0.24), col = sanzo.duo("c085"), pch = 15, bty = "n") 106 | 107 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c091"), main = "Combination 091", 108 | ylim = c(0, 20), border = NA) 109 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 110 | col = sanzo.duo("c091") [unclass(datasets::iris$Species)], ann = FALSE) 111 | graphics::legend("top", legend = c("#5c2c45", "#c05200"), horiz = TRUE, xpd = TRUE, 112 | inset = c(-0.24), col = sanzo.duo("c091"), pch = 15, bty = "n") 113 | 114 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c095"), main = "Combination 095", 115 | ylim = c(0, 20), border = NA) 116 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 117 | col = sanzo.duo("c095") [unclass(datasets::iris$Species)], ann = FALSE) 118 | graphics::legend("top", legend = c("#681916", "#06004f"), horiz = TRUE, xpd = TRUE, 119 | inset = c(-0.24), col = sanzo.duo("c095"), pch = 15, bty = "n") 120 | 121 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c102"), main = "Combination 102", 122 | ylim = c(0, 20), border = NA) 123 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 124 | col = sanzo.duo("c102") [unclass(datasets::iris$Species)], ann = FALSE) 125 | graphics::legend("top", legend = c("#ebd999", "#c05200"), horiz = TRUE, xpd = TRUE, 126 | inset = c(-0.24), col = sanzo.duo("c102"), pch = 15, bty = "n") 127 | 128 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c103"), main = "Combination 103", 129 | ylim = c(0, 20), border = NA) 130 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 131 | col = sanzo.duo("c103") [unclass(datasets::iris$Species)], ann = FALSE) 132 | graphics::legend("top", legend = c("#c2612c", "#2d0060"), horiz = TRUE, xpd = TRUE, 133 | inset = c(-0.24), col = sanzo.duo("c103"), pch = 15, bty = "n") 134 | 135 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c106"), main = "Combination 106", 136 | ylim = c(0, 20), border = NA) 137 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 138 | col = sanzo.duo("c106") [unclass(datasets::iris$Species)], ann = FALSE) 139 | graphics::legend("top", legend = c("#008aa1", "#06004f"), horiz = TRUE, xpd = TRUE, 140 | inset = c(-0.24), col = sanzo.duo("c106"), pch = 15, bty = "n") 141 | 142 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c114"), main = "Combination 114", 143 | ylim = c(0, 20), border = NA) 144 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 145 | col = sanzo.duo("c114") [unclass(datasets::iris$Species)], ann = FALSE) 146 | graphics::legend("top", legend = c("#ffab00", "#008aa1"), horiz = TRUE, xpd = TRUE, 147 | inset = c(-0.24), col = sanzo.duo("c114"), pch = 15, bty = "n") 148 | 149 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c118"), main = "Combination 118", 150 | ylim = c(0, 20), border = NA) 151 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 152 | col = sanzo.duo("c118") [unclass(datasets::iris$Species)], ann = FALSE) 153 | graphics::legend("top", legend = c("#e0b81f", "#362304"), horiz = TRUE, xpd = TRUE, 154 | inset = c(-0.24), col = sanzo.duo("c118"), pch = 15, bty = "n") 155 | 156 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c119"), main = "Combination 119", 157 | ylim = c(0, 20), border = NA) 158 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 159 | col = sanzo.duo("c119") [unclass(datasets::iris$Species)], ann = FALSE) 160 | graphics::legend("top", legend = c("#a6e6db", "#0d2b52"), horiz = TRUE, xpd = TRUE, 161 | inset = c(-0.24), col = sanzo.duo("c119"), pch = 15, bty = "n") 162 | 163 | graphics::barplot(datasets::BOD$demand, col = sanzo.duo("c229"), main = "Combination 229", 164 | ylim = c(0, 20), border = NA) 165 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Sepal.Length, pch = 18:19, 166 | col = sanzo.duo("c229") [unclass(datasets::iris$Species)], ann = FALSE) 167 | graphics::legend("top", legend = c("#172713", "#b5d1cc"), horiz = TRUE, xpd = TRUE, 168 | inset = c(-0.24), col = sanzo.duo("c229"), pch = 15, bty = "n") 169 | 170 | } 171 | 172 | #' Print demo plots for all trio palettes 173 | #' 174 | #' Print demo base R plots for all 20 trio palettes to illustrate 175 | #' their use and display hexadecimal values. 176 | #' 177 | #' @examples 178 | #' sanzo.demo3() 179 | #' 180 | #' @export 181 | #' 182 | sanzo.demo3 <- function() { 183 | 184 | # Check that required packages are installed. 185 | 186 | if (!requireNamespace("datasets", quietly = TRUE)) { 187 | stop("Package \"datasets\" required for function. Please install this package to proceed.", 188 | call. = FALSE) 189 | } 190 | else if (!requireNamespace("graphics", quietly = TRUE)) { 191 | stop("Package \"graphics\" required for function. Please install this package to proceed.", 192 | call. = FALSE) 193 | } 194 | else if (!requireNamespace("stats", quietly = TRUE)) { 195 | stop("Package \"stats\" required for function. Please install this package to proceed.", 196 | call. = FALSE) 197 | } 198 | 199 | # Print demo plots. 200 | 201 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c121"), main = "Combination 121", 202 | ylim = c(0, 20), border = NA) 203 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 204 | col = sanzo.trio("c121") [unclass(datasets::iris$Species)], ann = FALSE) 205 | graphics::legend("top", legend = c("#6c2b11", "#d99e73", "#405416"),horiz = TRUE, xpd = TRUE, 206 | inset = c(-0.24), col = sanzo.trio("c121"), pch = 15, bty = "n") 207 | 208 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c139"), main = "Combination 139", 209 | ylim = c(0, 20), border = NA) 210 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 211 | col = sanzo.trio("c139") [unclass(datasets::iris$Species)], ann = FALSE) 212 | graphics::legend("top", legend = c("#96bfe6", "#000831", "#b5d1cc"), horiz = TRUE, xpd = TRUE, 213 | inset = c(-0.24), col = sanzo.trio("c139"), pch = 15, bty = "n") 214 | 215 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c142"), main = "Combination 142", 216 | ylim = c(0, 20), border = NA) 217 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 218 | col = sanzo.trio("c142") [unclass(datasets::iris$Species)], ann = FALSE) 219 | graphics::legend("top", legend = c("#9e194d", "#baa600", "#96bfe6"), horiz = TRUE, xpd = TRUE, 220 | inset = c(-0.24), col = sanzo.trio("c142"), pch = 15, bty = "n") 221 | 222 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c148"), main = "Combination 148", 223 | ylim = c(0, 20), border = NA) 224 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 225 | col = sanzo.trio("c148") [unclass(datasets::iris$Species)], ann = FALSE) 226 | graphics::legend("top", legend = c("#d1bd19", "#ffab00", "#29bdad"), horiz = TRUE, xpd = TRUE, 227 | inset = c(-0.24), col = sanzo.trio("c148"), pch = 15, bty = "n") 228 | 229 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c149"), main = "Combination 149", 230 | ylim = c(0, 20), border = NA) 231 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 232 | col = sanzo.trio("c149") [unclass(datasets::iris$Species)], ann = FALSE) 233 | graphics::legend("top", legend = c("#d1bd19", "#ff5200", "#0f261f"), horiz = TRUE, xpd = TRUE, 234 | inset = c(-0.24), col = sanzo.trio("c149"), pch = 15, bty = "n") 235 | 236 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c157"), main = "Combination 157", 237 | ylim = c(0, 20), border = NA) 238 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 239 | col = sanzo.trio("c157") [unclass(datasets::iris$Species)], ann = FALSE) 240 | graphics::legend("top", legend = c("#6f0043", "#d1bd19", "#4f8fe6"), horiz = TRUE, xpd = TRUE, 241 | inset = c(-0.24), col = sanzo.trio("c157"), pch = 15, bty = "n") 242 | 243 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c163"), main = "Combination 163", 244 | ylim = c(0, 20), border = NA) 245 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 246 | col = sanzo.trio("c163") [unclass(datasets::iris$Species)], ann = FALSE) 247 | graphics::legend("top", legend = c("#ffe600", "#b5ffc2", "#008aa1"), horiz = TRUE, xpd = TRUE, 248 | inset = c(-0.24), col = sanzo.trio("c163"), pch = 15, bty = "n") 249 | 250 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c171"), main = "Combination 171", 251 | ylim = c(0, 20), border = NA) 252 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 253 | col = sanzo.trio("c171") [unclass(datasets::iris$Species)], ann = FALSE) 254 | graphics::legend("top", legend = c("#730f1f", "#ff8c00", "#b3e8c2"), horiz = TRUE, xpd = TRUE, 255 | inset = c(-0.24), col = sanzo.trio("c171"), pch = 15, bty = "n") 256 | 257 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c172"), main = "Combination 172", 258 | ylim = c(0, 20), border = NA) 259 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 260 | col = sanzo.trio("c172") [unclass(datasets::iris$Species)], ann = FALSE) 261 | graphics::legend("top", legend = c("#c2612c", "#008aa1", "#3400a3"), horiz = TRUE, xpd = TRUE, 262 | inset = c(-0.24), col = sanzo.trio("c172"), pch = 15, bty = "n") 263 | 264 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c174"), main = "Combination 174", 265 | ylim = c(0, 20), border = NA) 266 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 267 | col = sanzo.trio("c174") [unclass(datasets::iris$Species)], ann = FALSE) 268 | graphics::legend("top", legend = c("#ffa6d9", "#bfabcc", "#6b2e63"), horiz = TRUE, xpd = TRUE, 269 | inset = c(-0.24), col = sanzo.trio("c174"), pch = 15, bty = "n") 270 | 271 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c194"), main = "Combination 194", 272 | ylim = c(0, 20), border = NA) 273 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 274 | col = sanzo.trio("c194") [unclass(datasets::iris$Species)], ann = FALSE) 275 | graphics::legend("top", legend = c("#fa2b00", "#ffcfc4", "#4f8fe6"), horiz = TRUE, xpd = TRUE, 276 | inset = c(-0.24), col = sanzo.trio("c194"), pch = 15, bty = "n") 277 | 278 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c204"), main = "Combination 204", 279 | ylim = c(0, 20), border = NA) 280 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 281 | col = sanzo.trio("c204") [unclass(datasets::iris$Species)], ann = FALSE) 282 | graphics::legend("top", legend = c("#b319ab", "#c2612c", "#a6e6db"), horiz = TRUE, xpd = TRUE, 283 | inset = c(-0.24), col = sanzo.trio("c204"), pch = 15, bty = "n") 284 | 285 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c205"), main = "Combination 205", 286 | ylim = c(0, 20), border = NA) 287 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 288 | col = sanzo.trio("c205") [unclass(datasets::iris$Species)], ann = FALSE) 289 | graphics::legend("top", legend = c("#730f1f", "#f59994", "#2619d1"), horiz = TRUE, xpd = TRUE, 290 | inset = c(-0.24), col = sanzo.trio("c205"), pch = 15, bty = "n") 291 | 292 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c207"), main = "Combination 207", 293 | ylim = c(0, 20), border = NA) 294 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 295 | col = sanzo.trio("c207") [unclass(datasets::iris$Species)], ann = FALSE) 296 | graphics::legend("top", legend = c("#9b5348", "#b3e8c2", "#000000"), horiz = TRUE, xpd = TRUE, 297 | inset = c(-0.24), col = sanzo.trio("c207"), pch = 15, bty = "n") 298 | 299 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c223"), main = "Combination 223", 300 | ylim = c(0, 20), border = NA) 301 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 302 | col = sanzo.trio("c223") [unclass(datasets::iris$Species)], ann = FALSE) 303 | graphics::legend("top", legend = c("#b08699", "#d99e73", "#b5ffc2"), horiz = TRUE, xpd = TRUE, 304 | inset = c(-0.24), col = sanzo.trio("c223"), pch = 15, bty = "n") 305 | 306 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c226"), main = "Combination 226", 307 | ylim = c(0, 20), border = NA) 308 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 309 | col = sanzo.trio("c226") [unclass(datasets::iris$Species)], ann = FALSE) 310 | graphics::legend("top", legend = c("#5c2c45", "#ffb852", "#2619d1"), horiz = TRUE, xpd = TRUE, 311 | inset = c(-0.24), col = sanzo.trio("c226"), pch = 15, bty = "n") 312 | 313 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c232"), main = "Combination 232", 314 | ylim = c(0, 20), border = NA) 315 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 316 | col = sanzo.trio("c232") [unclass(datasets::iris$Species)], ann = FALSE) 317 | graphics::legend("top", legend = c("#d60036", "#f2ad78", "#000831"), horiz = TRUE, xpd = TRUE, 318 | inset = c(-0.24), col = sanzo.trio("c232"), pch = 15, bty = "n") 319 | 320 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c239"), main = "Combination 239", 321 | ylim = c(0, 20), border = NA) 322 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 323 | col = sanzo.trio("c239") [unclass(datasets::iris$Species)], ann = FALSE) 324 | graphics::legend("top", legend = c("#b08699", "#c4bf33", "#b3e8c2"), horiz = TRUE, xpd = TRUE, 325 | inset = c(-0.24), col = sanzo.trio("c239"), pch = 15, bty = "n") 326 | 327 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c240"), main = "Combination 240", 328 | ylim = c(0, 20), border = NA) 329 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 330 | col = sanzo.trio("c240") [unclass(datasets::iris$Species)], ann = FALSE) 331 | graphics::legend("top", legend = c("#ff788c", "#ffff00", "#29bdad"), horiz = TRUE, xpd = TRUE, 332 | inset = c(-0.24), col = sanzo.trio("c240"), pch = 15, bty = "n") 333 | 334 | graphics::barplot(datasets::BOD$demand, col = sanzo.trio("c343"), main = "Combination 343", 335 | ylim = c(0, 20), border = NA) 336 | graphics::plot(datasets::iris$Sepal.Width, datasets::iris$Petal.Width, pch = 18:20, 337 | col = sanzo.trio("c343") [unclass(datasets::iris$Species)], ann = FALSE) 338 | graphics::legend("top", legend = c("#a93400", "#ebd999", "#505423"), horiz = TRUE, xpd = TRUE, 339 | inset = c(-0.24), col = sanzo.trio("c343"), pch = 15, bty = "n") 340 | 341 | } 342 | 343 | #' Print demo plots for all quad palettes 344 | #' 345 | #' Print demo base R plots for all 20 quad palettes to illustrate 346 | #' their use and display hexadecimal values. 347 | #' 348 | #' @examples 349 | #' 350 | #' sanzo.demo4() 351 | #' 352 | #' @export 353 | #' 354 | sanzo.demo4 <- function() { 355 | 356 | # Check that required packages are installed. 357 | 358 | if (!requireNamespace("datasets", quietly = TRUE)) { 359 | stop("Package \"datasets\" required for function. Please install this package to proceed.", 360 | call. = FALSE) 361 | } 362 | else if (!requireNamespace("graphics", quietly = TRUE)) { 363 | stop("Package \"graphics\" required for function. Please install this package to proceed.", 364 | call. = FALSE) 365 | } 366 | else if (!requireNamespace("stats", quietly = TRUE)) { 367 | stop("Package \"stats\" required for function. Please install this package to proceed.", 368 | call. = FALSE) 369 | } 370 | 371 | # Create data frames for demo plots. 372 | 373 | x <- c(1, 2, 3, 4, 5, 6, 7, 8) 374 | y <- c(6.5, 9.6, 8.9, 12.1, 13.2, 16.9, 15.8, 19) 375 | 376 | df_bar <- data.frame(x, y) 377 | 378 | group1 <- stats::rnorm(40, mean = 80.2, sd = 9.7) 379 | group2 <- stats::rnorm(20, mean = 75.3, sd = 15) 380 | group3 <- stats::rnorm(30, mean = 43.3, sd = 10.2) 381 | group4 <- stats::rnorm(20, mean = 55.8, sd = 12) 382 | value <- c(group1, group2, group3, group4) 383 | category <- c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 384 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 385 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 386 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 387 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 388 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4) 389 | 390 | df_scatter <- data.frame(value, category) 391 | 392 | # Print demo plots. 393 | 394 | graphics::barplot(df_bar$y, col = sanzo.quad("c249"), main = "Combination 249", 395 | ylim = c(0, 20), border = NA) 396 | graphics::plot(df_scatter$value, pch = 18:20, 397 | col = sanzo.quad("c249") [unclass(df_scatter$category)], ann = FALSE) 398 | graphics::legend("top", legend = c("#681916", "#c0b490", "#d1bd19", "#417777"), horiz = TRUE, 399 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c249"), pch = 15, bty = "n") 400 | 401 | graphics::barplot(df_bar$y, col = sanzo.quad("c252"), main = "Combination 252", 402 | ylim = c(0, 20), border = NA) 403 | graphics::plot(df_scatter$value, pch = 18:20, 404 | col = sanzo.quad("c252") [unclass(df_scatter$category)], ann = FALSE) 405 | graphics::legend("top", legend = c("#e62e73", "#b85e00", "#baa600", "#2dbc94"), horiz = TRUE, 406 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c252"), pch = 15, bty = "n") 407 | 408 | graphics::barplot(df_bar$y, col = sanzo.quad("c263"), main = "Combination 263", 409 | ylim = c(0, 20), border = NA) 410 | graphics::plot(df_scatter$value, pch = 18:20, 411 | col = sanzo.quad("c263") [unclass(df_scatter$category)], ann = FALSE) 412 | graphics::legend("top", legend = c("#a93400", "#f2ad78", "#b5ffc2", "#1b3644"), horiz = TRUE, 413 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c263"), pch = 15, bty = "n") 414 | 415 | graphics::barplot(df_bar$y, col = sanzo.quad("c268"), main = "Combination 268", 416 | ylim = c(0, 20), border = NA) 417 | graphics::plot(df_scatter$value, pch = 18:20, 418 | col = sanzo.quad("c268") [unclass(df_scatter$category)], ann = FALSE) 419 | graphics::legend("top", legend = c("#b08699", "#b85e00", "#172713", "#bfffe6"), horiz = TRUE, 420 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c268"), pch = 15, bty = "n") 421 | 422 | graphics::barplot(df_bar$y, col = sanzo.quad("c271"), main = "Combination 271", 423 | ylim = c(0, 20), border = NA) 424 | graphics::plot(df_scatter$value, pch = 18:20, 425 | col = sanzo.quad("c271") [unclass(df_scatter$category)], ann = FALSE) 426 | graphics::legend("top", legend = c("#b90078", "#94ff94", "#2dbc94", "#0f261f"), horiz = TRUE, 427 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c271"), pch = 15, bty = "n") 428 | 429 | graphics::barplot(df_bar$y, col = sanzo.quad("c273"), main = "Combination 273", 430 | ylim = c(0, 20), border = NA) 431 | graphics::plot(df_scatter$value, pch = 18:20, 432 | col = sanzo.quad("c273") [unclass(df_scatter$category)], ann = FALSE) 433 | graphics::legend("top", legend = c("#ffb3f0", "#6f0043", "#9b5348", "#b5d1cc"), horiz = TRUE, 434 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c273"), pch = 15, bty = "n") 435 | 436 | graphics::barplot(df_bar$y, col = sanzo.quad("c279"), main = "Combination 279", 437 | ylim = c(0, 20), border = NA) 438 | graphics::plot(df_scatter$value, pch = 18:20, 439 | col = sanzo.quad("c279") [unclass(df_scatter$category)], ann = FALSE) 440 | graphics::legend("top", legend = c("#b85e00", "#f59994", "#c0b490", "#0d2b52"), horiz = TRUE, 441 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c279"), pch = 15, bty = "n") 442 | 443 | graphics::barplot(df_bar$y, col = sanzo.quad("c283"), main = "Combination 283", 444 | ylim = c(0, 20), border = NA) 445 | graphics::plot(df_scatter$value, pch = 18:20, 446 | col = sanzo.quad("c283") [unclass(df_scatter$category)], ann = FALSE) 447 | graphics::legend("top", legend = c("#a7374b", "#730f1f", "#85b857", "#6bffb3"), horiz = TRUE, 448 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c283"), pch = 15, bty = "n") 449 | 450 | graphics::barplot(df_bar$y, col = sanzo.quad("c289"), main = "Combination 289", 451 | ylim = c(0, 20), border = NA) 452 | graphics::plot(df_scatter$value, pch = 18:20, 453 | col = sanzo.quad("c289") [unclass(df_scatter$category)], ann = FALSE) 454 | graphics::legend("top", legend = c("#f2ff26", "#bdf226", "#202d85", "#06004f"), horiz = TRUE, 455 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c289"), pch = 15, bty = "n") 456 | 457 | graphics::barplot(df_bar$y, col = sanzo.quad("c293"), main = "Combination 293", 458 | ylim = c(0, 20), border = NA) 459 | graphics::plot(df_scatter$value, pch = 18:20, 460 | col = sanzo.quad("c293") [unclass(df_scatter$category)], ann = FALSE) 461 | graphics::legend("top", legend = c("#b85e00", "#b5ffc2", "#65a98f", "#40c945"), horiz = TRUE, 462 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c293"), pch = 15, bty = "n") 463 | 464 | graphics::barplot(df_bar$y, col = sanzo.quad("c296"), main = "Combination 296", 465 | ylim = c(0, 20), border = NA) 466 | graphics::plot(df_scatter$value, pch = 18:20, 467 | col = sanzo.quad("c296") [unclass(df_scatter$category)], ann = FALSE) 468 | graphics::legend("top", legend = c("#f5f5b8", "#d99e73", "#5e4017", "#1b3644"), horiz = TRUE, 469 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c296"), pch = 15, bty = "n") 470 | 471 | graphics::barplot(df_bar$y, col = sanzo.quad("c302"), main = "Combination 302", 472 | ylim = c(0, 20), border = NA) 473 | graphics::plot(df_scatter$value, pch = 18:20, 474 | col = sanzo.quad("c302") [unclass(df_scatter$category)], ann = FALSE) 475 | graphics::legend("top", legend = c("#ffb852", "#c0b490", "#bfffe6", "#008aa1"), horiz = TRUE, 476 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c302"), pch = 15, bty = "n") 477 | 478 | graphics::barplot(df_bar$y, col = sanzo.quad("c310"), main = "Combination 310", 479 | ylim = c(0, 20), border = NA) 480 | graphics::plot(df_scatter$value, pch = 18:20, 481 | col = sanzo.quad("c310") [unclass(df_scatter$category)], ann = FALSE) 482 | graphics::legend("top", legend = c("#f5f5b8", "#f2ad78", "#718600", "#172713"), horiz = TRUE, 483 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c310"), pch = 15, bty = "n") 484 | 485 | graphics::barplot(df_bar$y, col = sanzo.quad("c321"), main = "Combination 321", 486 | ylim = c(0, 20), border = NA) 487 | graphics::plot(df_scatter$value, pch = 18:20, 488 | col = sanzo.quad("c321") [unclass(df_scatter$category)], ann = FALSE) 489 | graphics::legend("top", legend = c("#b08699", "#f5f5b8", "#172713", "#96bfe6"), horiz = TRUE, 490 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c321"), pch = 15, bty = "n") 491 | 492 | graphics::barplot(df_bar$y, col = sanzo.quad("c329"), main = "Combination 329", 493 | ylim = c(0, 20), border = NA) 494 | graphics::plot(df_scatter$value, pch = 18:20, 495 | col = sanzo.quad("c329") [unclass(df_scatter$category)], ann = FALSE) 496 | graphics::legend("top", legend = c("#ffb852", "#bfabcc", "#340059", "#1b3644"), horiz = TRUE, 497 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c329"), pch = 15, bty = "n") 498 | 499 | graphics::barplot(df_bar$y, col = sanzo.quad("c330"), main = "Combination 330", 500 | ylim = c(0, 20), border = NA) 501 | graphics::plot(df_scatter$value, pch = 18:20, 502 | col = sanzo.quad("c330") [unclass(df_scatter$category)], ann = FALSE) 503 | graphics::legend("top", legend = c("#bcd382", "#bfffe6", "#96bfe6", "#2dbc94"), horiz = TRUE, 504 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c330"), pch = 15, bty = "n") 505 | 506 | graphics::barplot(df_bar$y, col = sanzo.quad("c332"), main = "Combination 332", 507 | ylim = c(0, 20), border = NA) 508 | graphics::plot(df_scatter$value, pch = 18:20, 509 | col = sanzo.quad("c332") [unclass(df_scatter$category)], ann = FALSE) 510 | graphics::legend("top", legend = c("#ff7399", "#d50c42", "#172713", "#00592e"), horiz = TRUE, 511 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c332"), pch = 15, bty = "n") 512 | 513 | graphics::barplot(df_bar$y, col = sanzo.quad("c339"), main = "Combination 339", 514 | ylim = c(0, 20), border = NA) 515 | graphics::plot(df_scatter$value, pch = 18:20, 516 | col = sanzo.quad("c339") [unclass(df_scatter$category)], ann = FALSE) 517 | graphics::legend("top", legend = c("#d99e73", "#de4500", "#a6e6db", "#202d85"), horiz = TRUE, 518 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c339"), pch = 15, bty = "n") 519 | 520 | graphics::barplot(df_bar$y, col = sanzo.quad("c341"), main = "Combination 341", 521 | ylim = c(0, 20), border = NA) 522 | graphics::plot(df_scatter$value, pch = 18:20, 523 | col = sanzo.quad("c341") [unclass(df_scatter$category)], ann = FALSE) 524 | graphics::legend("top", legend = c("#ff616b", "#328e13", "#172713", "#a6e6db"), horiz = TRUE, 525 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c341"), pch = 15, bty = "n") 526 | 527 | graphics::barplot(df_bar$y, col = sanzo.quad("c348"), main = "Combination 348", 528 | ylim = c(0, 20), border = NA) 529 | graphics::plot(df_scatter$value, pch = 18:20, 530 | col = sanzo.quad("c348") [unclass(df_scatter$category)], ann = FALSE) 531 | graphics::legend("top", legend = c("#bcd382", "#328e13", "#172713", "#340059"), horiz = TRUE, 532 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c348"), pch = 15, bty = "n") 533 | 534 | } 535 | 536 | #' Print demo plots for all palettes 537 | #' 538 | #' Print demo base R plots for all 60 sanzo palettes to illustrate 539 | #' their use and display hexadecimal values. 540 | #' 541 | #' @examples 542 | #' sanzo.demo.all() 543 | #' 544 | #' @export 545 | #' 546 | sanzo.demo.all <- function() { 547 | 548 | sanzo.demo2() 549 | sanzo.demo3() 550 | sanzo.demo4() 551 | 552 | } 553 | -------------------------------------------------------------------------------- /dev/sanzo.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "sanzo" 3 | author: "Jacqueline Maasch" 4 | date: "12/17/2019" 5 | output: html_document 6 | --- 7 | 8 | ```{r data, echo = FALSE, message = FALSE, warning = FALSE} 9 | 10 | # Use in-built datasets for base R demos. 11 | data("iris") 12 | data("BOD") 13 | data("faithfuld") 14 | data("DNase") 15 | 16 | # Load packages for ggplot2 demos. 17 | library(ggplot2) 18 | library(ggthemes) 19 | library(cowplot) 20 | 21 | # Read in data for ggplot2 demos. 22 | raw <- read.csv("/Users/razel/Desktop/PROGS/R_practice/2019/sth_plasmid_ct_mean_raw.csv") 23 | mean <- read.csv("/Users/razel/Desktop/PROGS/R_practice/2019/sth_plasmid_ct_mean.csv") 24 | ct <- read.csv("/Users/razel/Desktop/PROGS/R_practice/2019/niger_giardia_swab_study_2019/niger_comparative_ct_by_duplicate.csv") 25 | 26 | ``` 27 | 28 | ## Palette definitions. 29 | 30 | Duos, trios, and quads stored in lists. 31 | 32 | ```{r palettes, echo = FALSE} 33 | 34 | duos <- list( 35 | c006 = c("#ff616b", "#000831"), 36 | c007 = c("#ff5200", "#b3e8c2"), 37 | c008 = c("#c2612c", "#b8b8ff"), 38 | c033 = c("#b85e00", "#1b3644"), 39 | c035 = c("#b08699", "#a10b2b"), 40 | c047 = c("#c9303e", "#bfabcc"), 41 | c070 = c("#b85e00", "#405416"), 42 | c071 = c("#a90636", "#d99e73"), 43 | c074 = c("#b5ffc2", "#2dbc94"), 44 | c079 = c("#651300", "#2dbc94"), 45 | c085 = c("#c74300", "#008aa1"), 46 | c091 = c("#5c2c45", "#c05200"), 47 | c095 = c("#681916", "#06004f"), 48 | c102 = c("#ebd999", "#c05200"), 49 | c103 = c("#c2612c", "#2d0060"), 50 | c106 = c("#008aa1", "#06004f"), 51 | c114 = c("#ffab00", "#008aa1"), 52 | c118 = c("#e0b81f", "#362304"), 53 | c119 = c("#a6e6db", "#0d2b52"), 54 | c229 = c("#172713", "#b5d1cc") 55 | ) 56 | 57 | trios <- list( 58 | c121 = c("#6c2b11", "#d99e73", "#405416"), 59 | c139 = c("#96bfe6", "#000831", "#b5d1cc"), 60 | c142 = c("#9e194d", "#baa600", "#96bfe6"), 61 | c148 = c("#d1bd19", "#ffab00", "#29bdad"), 62 | c149 = c("#d1bd19", "#ff5200", "#0f261f"), 63 | c157 = c("#6f0043", "#d1bd19", "#4f8fe6"), 64 | c163 = c("#ffe600", "#b5ffc2", "#008aa1"), 65 | c171 = c("#730f1f", "#ff8c00", "#b3e8c2"), 66 | c172 = c("#c2612c", "#008aa1", "#3400a3"), 67 | c174 = c("#ffa6d9", "#bfabcc", "#6b2e63"), 68 | c194 = c("#fa2b00", "#ffcfc4", "#4f8fe6"), 69 | c204 = c("#b319ab", "#c2612c", "#a6e6db"), 70 | c205 = c("#730f1f", "#f59994", "#2619d1"), 71 | c207 = c("#9b5348", "#b3e8c2", "#000000"), 72 | c223 = c("#b08699", "#d99e73", "#b5ffc2"), 73 | c226 = c("#5c2c45", "#ffb852", "#2619d1"), 74 | c232 = c("#d60036", "#f2ad78", "#000831"), 75 | c239 = c("#b08699", "#c4bf33", "#b3e8c2"), 76 | c240 = c("#ff788c", "#ffff00", "#29bdad"), 77 | c343 = c("#a93400", "#ebd999", "#505423") 78 | ) 79 | 80 | quads <- list( 81 | c249 = c("#681916", "#c0b490", "#d1bd19", "#417777"), 82 | c252 = c("#e62e73", "#b85e00", "#baa600", "#2dbc94"), 83 | c263 = c("#a93400", "#f2ad78", "#b5ffc2", "#1b3644"), 84 | c268 = c("#b08699", "#b85e00", "#172713", "#bfffe6"), 85 | c271 = c("#b90078", "#94ff94", "#2dbc94", "#0f261f"), 86 | c273 = c("#ffb3f0", "#6f0043", "#9b5348", "#b5d1cc"), 87 | c279 = c("#b85e00", "#f59994", "#c0b490", "#0d2b52"), 88 | c283 = c("#a7374b", "#730f1f", "#85b857", "#6bffb3"), 89 | c289 = c("#f2ff26", "#bdf226", "#202d85", "#06004f"), 90 | c293 = c("#b85e00", "#b5ffc2", "#65a98f", "#40c945"), 91 | c296 = c("#f5f5b8", "#d99e73", "#5e4017", "#1b3644"), 92 | c302 = c("#ffb852", "#c0b490", "#bfffe6", "#008aa1"), 93 | c310 = c("#f5f5b8", "#f2ad78", "#718600", "#172713"), 94 | c321 = c("#b08699", "#f5f5b8", "#172713", "#96bfe6"), 95 | c329 = c("#ffb852", "#bfabcc", "#340059", "#1b3644"), 96 | c330 = c("#bcd382", "#bfffe6", "#96bfe6", "#2dbc94"), 97 | c332 = c("#ff7399", "#d50c42", "#172713", "#00592e"), 98 | c339 = c("#d99e73", "#de4500", "#a6e6db", "#202d85"), 99 | c341 = c("#ff616b", "#328e13", "#172713", "#a6e6db"), 100 | c348 = c("#bcd382", "#328e13", "#172713", "#340059") 101 | ) 102 | 103 | ``` 104 | 105 | # Functions. 106 | * ```sanzo.duo()``` : create duo palette 107 | * ```sanzo.trio()``` : create trio palette 108 | * ```sanzo.quad()``` : create quad palette 109 | * ```sanzo.demo2()``` : print demo plots for all duo palettes 110 | * ```sanzo.demo3()``` : print demo plots for all trio palettes 111 | * ```sanzo.demo4()``` : print demo plots for all quad palettes 112 | * ```sanzo.demo.all()``` : print demo plots for all palettes 113 | * ```sanzo.info2()``` : generate dataframe of hexadecimals and urls for all duo palettes 114 | * ```sanzo.info3()``` : generate dataframe of hexadecimals and urls for all trio palettes 115 | * ```sanzo.info4()``` : generate dataframe of hexadecimals and urls for all quad palettes 116 | * ```sanzo.info.all()``` : generate dataframe of hexadecimals and urls for all palettes 117 | 118 | ```{r functions, echo = FALSE} 119 | 120 | # Generate two-toned palette from sanzoDuos. 121 | sanzo.duo <- function(paletteName) { 122 | palette <- duos[[paletteName]] 123 | } 124 | 125 | # Generate three-toned palette from sanzoTrios. 126 | sanzo.trio <- function(paletteName) { 127 | palette <- trios[[paletteName]] 128 | } 129 | 130 | # Generate four-toned palette from sanzoQuads. 131 | sanzo.quad <- function(paletteName) { 132 | palette <- quads[[paletteName]] 133 | } 134 | 135 | # Print plots using color palette as a demo. 136 | # @param palette = palette name 137 | # @param n = number of colors in the palette 138 | demo2 <- function() { 139 | 140 | layout(matrix(1:4, nrow = 2)) 141 | par(mar = c(2, 2, 2, 2)) 142 | 143 | barplot(BOD$demand, col = sanzo.duo("c006"), main = "Combination 006", 144 | ylim = c(0, 20), border = NA) 145 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 146 | col = sanzo.duo("c006") [unclass(iris$Species)], ann = FALSE) 147 | legend("top", legend = c("#ff616b", "#000831"), horiz = TRUE, xpd = TRUE, 148 | inset = c(-0.24), col = sanzo.duo("c006"), pch = 15, bty = "n") 149 | 150 | barplot(BOD$demand, col = sanzo.duo("c007"), main = "Combination 007", 151 | ylim = c(0, 20), border = NA) 152 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 153 | col = sanzo.duo("c007") [unclass(iris$Species)], ann = FALSE) 154 | legend("top", legend = c("#ff5200", "#b3e8c2"), horiz = TRUE, xpd = TRUE, 155 | inset = c(-0.24), col = sanzo.duo("c007"), pch = 15, bty = "n") 156 | 157 | barplot(BOD$demand, col = sanzo.duo("c008"), main = "Combination 008", 158 | ylim = c(0, 20), border = NA) 159 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 160 | col = sanzo.duo("c008") [unclass(iris$Species)], ann = FALSE) 161 | legend("top", legend = c("#c2612c", "#b8b8ff"), horiz = TRUE, xpd = TRUE, 162 | inset = c(-0.24), col = sanzo.duo("c008"), pch = 15, bty = "n") 163 | 164 | barplot(BOD$demand, col = sanzo.duo("c033"), main = "Combination 033", 165 | ylim = c(0, 20), border = NA) 166 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 167 | col = sanzo.duo("c033") [unclass(iris$Species)], ann = FALSE) 168 | legend("top", legend = c("#b85e00", "#1b3644"), horiz = TRUE, xpd = TRUE, 169 | inset = c(-0.24), col = sanzo.duo("c033"), pch = 15, bty = "n") 170 | 171 | barplot(BOD$demand, col = sanzo.duo("c035"), main = "Combination 035", 172 | ylim = c(0, 20), border = NA) 173 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 174 | col = sanzo.duo("c035") [unclass(iris$Species)], ann = FALSE) 175 | legend("top", legend = c("#b08699", "#a10b2b"), horiz = TRUE, xpd = TRUE, 176 | inset = c(-0.24), col = sanzo.duo("c035"), pch = 15, bty = "n") 177 | 178 | barplot(BOD$demand, col = sanzo.duo("c047"), main = "Combination 047", 179 | ylim = c(0, 20), border = NA) 180 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 181 | col = sanzo.duo("c047") [unclass(iris$Species)], ann = FALSE) 182 | legend("top", legend = c("#c9303e", "#bfabcc"), horiz = TRUE, xpd = TRUE, 183 | inset = c(-0.24), col = sanzo.duo("c047"), pch = 15, bty = "n") 184 | 185 | barplot(BOD$demand, col = sanzo.duo("c070"), main = "Combination 070", 186 | ylim = c(0, 20), border = NA) 187 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 188 | col = sanzo.duo("c070") [unclass(iris$Species)], ann = FALSE) 189 | legend("top", legend = c("#b85e00", "#405416"), horiz = TRUE, xpd = TRUE, 190 | inset = c(-0.24), col = sanzo.duo("c070"), pch = 15, bty = "n") 191 | 192 | barplot(BOD$demand, col = sanzo.duo("c071"), main = "Combination 071", 193 | ylim = c(0, 20), border = NA) 194 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 195 | col = sanzo.duo("c071") [unclass(iris$Species)], ann = FALSE) 196 | legend("top", legend = c("#a90636", "#d99e73"), horiz = TRUE, xpd = TRUE, 197 | inset = c(-0.24), col = sanzo.duo("c071"), pch = 15, bty = "n") 198 | 199 | barplot(BOD$demand, col = sanzo.duo("c074"), main = "Combination 074", 200 | ylim = c(0, 20), border = NA) 201 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 202 | col = sanzo.duo("c074") [unclass(iris$Species)], ann = FALSE) 203 | legend("top", legend = c("#b5ffc2", "#2dbc94"), horiz = TRUE, xpd = TRUE, 204 | inset = c(-0.24), col = sanzo.duo("c074"), pch = 15, bty = "n") 205 | 206 | barplot(BOD$demand, col = sanzo.duo("c079"), main = "Combination 079", 207 | ylim = c(0, 20), border = NA) 208 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 209 | col = sanzo.duo("c079") [unclass(iris$Species)], ann = FALSE) 210 | legend("top", legend = c("#651300", "#2dbc94"), horiz = TRUE, xpd = TRUE, 211 | inset = c(-0.24), col = sanzo.duo("c079"), pch = 15, bty = "n") 212 | 213 | barplot(BOD$demand, col = sanzo.duo("c085"), main = "Combination 085", 214 | ylim = c(0, 20), border = NA) 215 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 216 | col = sanzo.duo("c085") [unclass(iris$Species)], ann = FALSE) 217 | legend("top", legend = c("#c74300", "#008aa1"), horiz = TRUE, xpd = TRUE, 218 | inset = c(-0.24), col = sanzo.duo("c085"), pch = 15, bty = "n") 219 | 220 | barplot(BOD$demand, col = sanzo.duo("c091"), main = "Combination 091", 221 | ylim = c(0, 20), border = NA) 222 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 223 | col = sanzo.duo("c091") [unclass(iris$Species)], ann = FALSE) 224 | legend("top", legend = c("#5c2c45", "#c05200"), horiz = TRUE, xpd = TRUE, 225 | inset = c(-0.24), col = sanzo.duo("c091"), pch = 15, bty = "n") 226 | 227 | barplot(BOD$demand, col = sanzo.duo("c095"), main = "Combination 095", 228 | ylim = c(0, 20), border = NA) 229 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 230 | col = sanzo.duo("c095") [unclass(iris$Species)], ann = FALSE) 231 | legend("top", legend = c("#681916", "#06004f"), horiz = TRUE, xpd = TRUE, 232 | inset = c(-0.24), col = sanzo.duo("c095"), pch = 15, bty = "n") 233 | 234 | barplot(BOD$demand, col = sanzo.duo("c102"), main = "Combination 102", 235 | ylim = c(0, 20), border = NA) 236 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 237 | col = sanzo.duo("c102") [unclass(iris$Species)], ann = FALSE) 238 | legend("top", legend = c("#ebd999", "#c05200"), horiz = TRUE, xpd = TRUE, 239 | inset = c(-0.24), col = sanzo.duo("c102"), pch = 15, bty = "n") 240 | 241 | barplot(BOD$demand, col = sanzo.duo("c103"), main = "Combination 103", 242 | ylim = c(0, 20), border = NA) 243 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 244 | col = sanzo.duo("c103") [unclass(iris$Species)], ann = FALSE) 245 | legend("top", legend = c("#c2612c", "#2d0060"), horiz = TRUE, xpd = TRUE, 246 | inset = c(-0.24), col = sanzo.duo("c103"), pch = 15, bty = "n") 247 | 248 | barplot(BOD$demand, col = sanzo.duo("c106"), main = "Combination 106", 249 | ylim = c(0, 20), border = NA) 250 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 251 | col = sanzo.duo("c106") [unclass(iris$Species)], ann = FALSE) 252 | legend("top", legend = c("#008aa1", "#06004f"), horiz = TRUE, xpd = TRUE, 253 | inset = c(-0.24), col = sanzo.duo("c106"), pch = 15, bty = "n") 254 | 255 | barplot(BOD$demand, col = sanzo.duo("c114"), main = "Combination 114", 256 | ylim = c(0, 20), border = NA) 257 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 258 | col = sanzo.duo("c114") [unclass(iris$Species)], ann = FALSE) 259 | legend("top", legend = c("#ffab00", "#008aa1"), horiz = TRUE, xpd = TRUE, 260 | inset = c(-0.24), col = sanzo.duo("c114"), pch = 15, bty = "n") 261 | 262 | barplot(BOD$demand, col = sanzo.duo("c118"), main = "Combination 118", 263 | ylim = c(0, 20), border = NA) 264 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 265 | col = sanzo.duo("c118") [unclass(iris$Species)], ann = FALSE) 266 | legend("top", legend = c("#e0b81f", "#362304"), horiz = TRUE, xpd = TRUE, 267 | inset = c(-0.24), col = sanzo.duo("c118"), pch = 15, bty = "n") 268 | 269 | barplot(BOD$demand, col = sanzo.duo("c119"), main = "Combination 119", 270 | ylim = c(0, 20), border = NA) 271 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 272 | col = sanzo.duo("c119") [unclass(iris$Species)], ann = FALSE) 273 | legend("top", legend = c("#a6e6db", "#0d2b52"), horiz = TRUE, xpd = TRUE, 274 | inset = c(-0.24), col = sanzo.duo("c119"), pch = 15, bty = "n") 275 | 276 | barplot(BOD$demand, col = sanzo.duo("c229"), main = "Combination 229", 277 | ylim = c(0, 20), border = NA) 278 | plot(iris$Sepal.Width, iris$Sepal.Length, pch = 18:19, 279 | col = sanzo.duo("c229") [unclass(iris$Species)], ann = FALSE) 280 | legend("top", legend = c("#172713", "#b5d1cc"), horiz = TRUE, xpd = TRUE, 281 | inset = c(-0.24), col = sanzo.duo("c229"), pch = 15, bty = "n") 282 | 283 | } 284 | 285 | # Print plots using color palette as a demo. 286 | # @param palette = palette name 287 | # @param n = number of colors in the palette 288 | demo3 <- function() { 289 | 290 | layout(matrix(1:4, nrow = 2)) 291 | par(mar = c(2, 2, 2, 2)) 292 | 293 | barplot(BOD$demand, col = sanzo.trio("c121"), main = "Combination 121", 294 | ylim = c(0, 20), border = NA) 295 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 296 | col = sanzo.trio("c121") [unclass(iris$Species)], ann = FALSE) 297 | legend("top", legend = c("#6c2b11", "#d99e73", "#405416"),horiz = TRUE, xpd = TRUE, 298 | inset = c(-0.24), col = sanzo.trio("c121"), pch = 15, bty = "n") 299 | 300 | barplot(BOD$demand, col = sanzo.trio("c139"), main = "Combination 139", 301 | ylim = c(0, 20), border = NA) 302 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 303 | col = sanzo.trio("c139") [unclass(iris$Species)], ann = FALSE) 304 | legend("top", legend = c("#96bfe6", "#000831", "#b5d1cc"), horiz = TRUE, xpd = TRUE, 305 | inset = c(-0.24), col = sanzo.trio("c139"), pch = 15, bty = "n") 306 | 307 | barplot(BOD$demand, col = sanzo.trio("c142"), main = "Combination 142", 308 | ylim = c(0, 20), border = NA) 309 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 310 | col = sanzo.trio("c142") [unclass(iris$Species)], ann = FALSE) 311 | legend("top", legend = c("#9e194d", "#baa600", "#96bfe6"), horiz = TRUE, xpd = TRUE, 312 | inset = c(-0.24), col = sanzo.trio("c142"), pch = 15, bty = "n") 313 | 314 | barplot(BOD$demand, col = sanzo.trio("c148"), main = "Combination 148", 315 | ylim = c(0, 20), border = NA) 316 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 317 | col = sanzo.trio("c148") [unclass(iris$Species)], ann = FALSE) 318 | legend("top", legend = c("#d1bd19", "#ffab00", "#29bdad"), horiz = TRUE, xpd = TRUE, 319 | inset = c(-0.24), col = sanzo.trio("c148"), pch = 15, bty = "n") 320 | 321 | barplot(BOD$demand, col = sanzo.trio("c149"), main = "Combination 149", 322 | ylim = c(0, 20), border = NA) 323 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 324 | col = sanzo.trio("c149") [unclass(iris$Species)], ann = FALSE) 325 | legend("top", legend = c("#d1bd19", "#ff5200", "#0f261f"), horiz = TRUE, xpd = TRUE, 326 | inset = c(-0.24), col = sanzo.trio("c149"), pch = 15, bty = "n") 327 | 328 | barplot(BOD$demand, col = sanzo.trio("c157"), main = "Combination 157", 329 | ylim = c(0, 20), border = NA) 330 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 331 | col = sanzo.trio("c157") [unclass(iris$Species)], ann = FALSE) 332 | legend("top", legend = c("#6f0043", "#d1bd19", "#4f8fe6"), horiz = TRUE, xpd = TRUE, 333 | inset = c(-0.24), col = sanzo.trio("c157"), pch = 15, bty = "n") 334 | 335 | barplot(BOD$demand, col = sanzo.trio("c163"), main = "Combination 163", 336 | ylim = c(0, 20), border = NA) 337 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 338 | col = sanzo.trio("c163") [unclass(iris$Species)], ann = FALSE) 339 | legend("top", legend = c("#ffe600", "#b5ffc2", "#008aa1"), horiz = TRUE, xpd = TRUE, 340 | inset = c(-0.24), col = sanzo.trio("c163"), pch = 15, bty = "n") 341 | 342 | barplot(BOD$demand, col = sanzo.trio("c171"), main = "Combination 171", 343 | ylim = c(0, 20), border = NA) 344 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 345 | col = sanzo.trio("c171") [unclass(iris$Species)], ann = FALSE) 346 | legend("top", legend = c("#730f1f", "#ff8c00", "#b3e8c2"), horiz = TRUE, xpd = TRUE, 347 | inset = c(-0.24), col = sanzo.trio("c171"), pch = 15, bty = "n") 348 | 349 | barplot(BOD$demand, col = sanzo.trio("c172"), main = "Combination 172", 350 | ylim = c(0, 20), border = NA) 351 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 352 | col = sanzo.trio("c172") [unclass(iris$Species)], ann = FALSE) 353 | legend("top", legend = c("#c2612c", "#008aa1", "#3400a3"), horiz = TRUE, xpd = TRUE, 354 | inset = c(-0.24), col = sanzo.trio("c172"), pch = 15, bty = "n") 355 | 356 | barplot(BOD$demand, col = sanzo.trio("c174"), main = "Combination 174", 357 | ylim = c(0, 20), border = NA) 358 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 359 | col = sanzo.trio("c174") [unclass(iris$Species)], ann = FALSE) 360 | legend("top", legend = c("#ffa6d9", "#bfabcc", "#6b2e63"), horiz = TRUE, xpd = TRUE, 361 | inset = c(-0.24), col = sanzo.trio("c174"), pch = 15, bty = "n") 362 | 363 | barplot(BOD$demand, col = sanzo.trio("c194"), main = "Combination 194", 364 | ylim = c(0, 20), border = NA) 365 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 366 | col = sanzo.trio("c194") [unclass(iris$Species)], ann = FALSE) 367 | legend("top", legend = c("#fa2b00", "#ffcfc4", "#4f8fe6"), horiz = TRUE, xpd = TRUE, 368 | inset = c(-0.24), col = sanzo.trio("c194"), pch = 15, bty = "n") 369 | 370 | barplot(BOD$demand, col = sanzo.trio("c204"), main = "Combination 204", 371 | ylim = c(0, 20), border = NA) 372 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 373 | col = sanzo.trio("c204") [unclass(iris$Species)], ann = FALSE) 374 | legend("top", legend = c("#b319ab", "#c2612c", "#a6e6db"), horiz = TRUE, xpd = TRUE, 375 | inset = c(-0.24), col = sanzo.trio("c204"), pch = 15, bty = "n") 376 | 377 | barplot(BOD$demand, col = sanzo.trio("c205"), main = "Combination 205", 378 | ylim = c(0, 20), border = NA) 379 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 380 | col = sanzo.trio("c205") [unclass(iris$Species)], ann = FALSE) 381 | legend("top", legend = c("#730f1f", "#f59994", "#2619d1"), horiz = TRUE, xpd = TRUE, 382 | inset = c(-0.24), col = sanzo.trio("c205"), pch = 15, bty = "n") 383 | 384 | barplot(BOD$demand, col = sanzo.trio("c207"), main = "Combination 207", 385 | ylim = c(0, 20), border = NA) 386 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 387 | col = sanzo.trio("c207") [unclass(iris$Species)], ann = FALSE) 388 | legend("top", legend = c("#9b5348", "#b3e8c2", "#000000"), horiz = TRUE, xpd = TRUE, 389 | inset = c(-0.24), col = sanzo.trio("c207"), pch = 15, bty = "n") 390 | 391 | barplot(BOD$demand, col = sanzo.trio("c223"), main = "Combination 223", 392 | ylim = c(0, 20), border = NA) 393 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 394 | col = sanzo.trio("c223") [unclass(iris$Species)], ann = FALSE) 395 | legend("top", legend = c("#b08699", "#d99e73", "#b5ffc2"), horiz = TRUE, xpd = TRUE, 396 | inset = c(-0.24), col = sanzo.trio("c223"), pch = 15, bty = "n") 397 | 398 | barplot(BOD$demand, col = sanzo.trio("c226"), main = "Combination 226", 399 | ylim = c(0, 20), border = NA) 400 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 401 | col = sanzo.trio("c226") [unclass(iris$Species)], ann = FALSE) 402 | legend("top", legend = c("#5c2c45", "#ffb852", "#2619d1"), horiz = TRUE, xpd = TRUE, 403 | inset = c(-0.24), col = sanzo.trio("c226"), pch = 15, bty = "n") 404 | 405 | barplot(BOD$demand, col = sanzo.trio("c232"), main = "Combination 232", 406 | ylim = c(0, 20), border = NA) 407 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 408 | col = sanzo.trio("c232") [unclass(iris$Species)], ann = FALSE) 409 | legend("top", legend = c("#d60036", "#f2ad78", "#000831"), horiz = TRUE, xpd = TRUE, 410 | inset = c(-0.24), col = sanzo.trio("c232"), pch = 15, bty = "n") 411 | 412 | barplot(BOD$demand, col = sanzo.trio("c239"), main = "Combination 239", 413 | ylim = c(0, 20), border = NA) 414 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 415 | col = sanzo.trio("c239") [unclass(iris$Species)], ann = FALSE) 416 | legend("top", legend = c("#b08699", "#c4bf33", "#b3e8c2"), horiz = TRUE, xpd = TRUE, 417 | inset = c(-0.24), col = sanzo.trio("c239"), pch = 15, bty = "n") 418 | 419 | barplot(BOD$demand, col = sanzo.trio("c240"), main = "Combination 240", 420 | ylim = c(0, 20), border = NA) 421 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 422 | col = sanzo.trio("c240") [unclass(iris$Species)], ann = FALSE) 423 | legend("top", legend = c("#ff788c", "#ffff00", "#29bdad"), horiz = TRUE, xpd = TRUE, 424 | inset = c(-0.24), col = sanzo.trio("c240"), pch = 15, bty = "n") 425 | 426 | barplot(BOD$demand, col = sanzo.trio("c343"), main = "Combination 343", 427 | ylim = c(0, 20), border = NA) 428 | plot(iris$Sepal.Width, iris$Petal.Width, pch = 18:20, 429 | col = sanzo.trio("c343") [unclass(iris$Species)], ann = FALSE) 430 | legend("top", legend = c("#a93400", "#ebd999", "#505423"), horiz = TRUE, xpd = TRUE, 431 | inset = c(-0.24), col = sanzo.trio("c343"), pch = 15, bty = "n") 432 | 433 | } 434 | 435 | # Print plots using color palette as a demo. 436 | # @param palette = palette name 437 | # @param n = number of colors in the palette 438 | demo4 <- function() { 439 | 440 | x <- c(1, 2, 3, 4, 5, 6, 7, 8) 441 | y <- c(6.5, 9.6, 8.9, 12.1, 13.2, 16.9, 15.8, 19) 442 | 443 | df_bar <- data.frame(x, y) 444 | 445 | group1 <- rnorm(40, mean = 80.2, sd = 9.7) 446 | group2 <- rnorm(20, mean = 75.3, sd = 15) 447 | group3 <- rnorm(30, mean = 43.3, sd = 10.2) 448 | group4 <- rnorm(20, mean = 55.8, sd = 12) 449 | value <- c(group1, group2, group3, group4) 450 | category <- c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 451 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 452 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 453 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 454 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 455 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4) 456 | 457 | df_scatter <- data.frame(value, category) 458 | 459 | layout(matrix(1:4, nrow = 2)) 460 | par(mar = c(2, 2, 2, 2)) 461 | 462 | barplot(df_bar$y, col = sanzo.quad("c249"), main = "Combination 249", 463 | ylim = c(0, 20), border = NA) 464 | plot(df_scatter$value, pch = 18:20, 465 | col = sanzo.quad("c249") [unclass(df_scatter$category)], ann = FALSE) 466 | legend("top", legend = c("#681916", "#c0b490", "#d1bd19", "#417777"), horiz = TRUE, 467 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c249"), pch = 15, bty = "n") 468 | 469 | barplot(df_bar$y, col = sanzo.quad("c252"), main = "Combination 252", 470 | ylim = c(0, 20), border = NA) 471 | plot(df_scatter$value, pch = 18:20, 472 | col = sanzo.quad("c252") [unclass(df_scatter$category)], ann = FALSE) 473 | legend("top", legend = c("#e62e73", "#b85e00", "#baa600", "#2dbc94"), horiz = TRUE, 474 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c252"), pch = 15, bty = "n") 475 | 476 | barplot(df_bar$y, col = sanzo.quad("c263"), main = "Combination 263", 477 | ylim = c(0, 20), border = NA) 478 | plot(df_scatter$value, pch = 18:20, 479 | col = sanzo.quad("c263") [unclass(df_scatter$category)], ann = FALSE) 480 | legend("top", legend = c("#a93400", "#f2ad78", "#b5ffc2", "#1b3644"), horiz = TRUE, 481 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c263"), pch = 15, bty = "n") 482 | 483 | barplot(df_bar$y, col = sanzo.quad("c268"), main = "Combination 268", 484 | ylim = c(0, 20), border = NA) 485 | plot(df_scatter$value, pch = 18:20, 486 | col = sanzo.quad("c268") [unclass(df_scatter$category)], ann = FALSE) 487 | legend("top", legend = c("#b08699", "#b85e00", "#172713", "#bfffe6"), horiz = TRUE, 488 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c268"), pch = 15, bty = "n") 489 | 490 | barplot(df_bar$y, col = sanzo.quad("c271"), main = "Combination 271", 491 | ylim = c(0, 20), border = NA) 492 | plot(df_scatter$value, pch = 18:20, 493 | col = sanzo.quad("c271") [unclass(df_scatter$category)], ann = FALSE) 494 | legend("top", legend = c("#b90078", "#94ff94", "#2dbc94", "#0f261f"), horiz = TRUE, 495 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c271"), pch = 15, bty = "n") 496 | 497 | barplot(df_bar$y, col = sanzo.quad("c273"), main = "Combination 273", 498 | ylim = c(0, 20), border = NA) 499 | plot(df_scatter$value, pch = 18:20, 500 | col = sanzo.quad("c273") [unclass(df_scatter$category)], ann = FALSE) 501 | legend("top", legend = c("#ffb3f0", "#6f0043", "#9b5348", "#b5d1cc"), horiz = TRUE, 502 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c273"), pch = 15, bty = "n") 503 | 504 | barplot(df_bar$y, col = sanzo.quad("c279"), main = "Combination 279", 505 | ylim = c(0, 20), border = NA) 506 | plot(df_scatter$value, pch = 18:20, 507 | col = sanzo.quad("c279") [unclass(df_scatter$category)], ann = FALSE) 508 | legend("top", legend = c("#b85e00", "#f59994", "#c0b490", "#0d2b52"), horiz = TRUE, 509 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c279"), pch = 15, bty = "n") 510 | 511 | barplot(df_bar$y, col = sanzo.quad("c283"), main = "Combination 283", 512 | ylim = c(0, 20), border = NA) 513 | plot(df_scatter$value, pch = 18:20, 514 | col = sanzo.quad("c283") [unclass(df_scatter$category)], ann = FALSE) 515 | legend("top", legend = c("#a7374b", "#730f1f", "#85b857", "#6bffb3"), horiz = TRUE, 516 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c283"), pch = 15, bty = "n") 517 | 518 | barplot(df_bar$y, col = sanzo.quad("c289"), main = "Combination 289", 519 | ylim = c(0, 20), border = NA) 520 | plot(df_scatter$value, pch = 18:20, 521 | col = sanzo.quad("c289") [unclass(df_scatter$category)], ann = FALSE) 522 | legend("top", legend = c("#f2ff26", "#bdf226", "#202d85", "#06004f"), horiz = TRUE, 523 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c289"), pch = 15, bty = "n") 524 | 525 | barplot(df_bar$y, col = sanzo.quad("c293"), main = "Combination 293", 526 | ylim = c(0, 20), border = NA) 527 | plot(df_scatter$value, pch = 18:20, 528 | col = sanzo.quad("c293") [unclass(df_scatter$category)], ann = FALSE) 529 | legend("top", legend = c("#b85e00", "#b5ffc2", "#65a98f", "#40c945"), horiz = TRUE, 530 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c293"), pch = 15, bty = "n") 531 | 532 | barplot(df_bar$y, col = sanzo.quad("c296"), main = "Combination 296", 533 | ylim = c(0, 20), border = NA) 534 | plot(df_scatter$value, pch = 18:20, 535 | col = sanzo.quad("c296") [unclass(df_scatter$category)], ann = FALSE) 536 | legend("top", legend = c("#f5f5b8", "#d99e73", "#5e4017", "#1b3644"), horiz = TRUE, 537 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c296"), pch = 15, bty = "n") 538 | 539 | barplot(df_bar$y, col = sanzo.quad("c302"), main = "Combination 302", 540 | ylim = c(0, 20), border = NA) 541 | plot(df_scatter$value, pch = 18:20, 542 | col = sanzo.quad("c302") [unclass(df_scatter$category)], ann = FALSE) 543 | legend("top", legend = c("#ffb852", "#c0b490", "#bfffe6", "#008aa1"), horiz = TRUE, 544 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c302"), pch = 15, bty = "n") 545 | 546 | barplot(df_bar$y, col = sanzo.quad("c310"), main = "Combination 310", 547 | ylim = c(0, 20), border = NA) 548 | plot(df_scatter$value, pch = 18:20, 549 | col = sanzo.quad("c310") [unclass(df_scatter$category)], ann = FALSE) 550 | legend("top", legend = c("#f5f5b8", "#f2ad78", "#718600", "#172713"), horiz = TRUE, 551 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c310"), pch = 15, bty = "n") 552 | 553 | barplot(df_bar$y, col = sanzo.quad("c321"), main = "Combination 321", 554 | ylim = c(0, 20), border = NA) 555 | plot(df_scatter$value, pch = 18:20, 556 | col = sanzo.quad("c321") [unclass(df_scatter$category)], ann = FALSE) 557 | legend("top", legend = c("#b08699", "#f5f5b8", "#172713", "#96bfe6"), horiz = TRUE, 558 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c321"), pch = 15, bty = "n") 559 | 560 | barplot(df_bar$y, col = sanzo.quad("c329"), main = "Combination 329", 561 | ylim = c(0, 20), border = NA) 562 | plot(df_scatter$value, pch = 18:20, 563 | col = sanzo.quad("c329") [unclass(df_scatter$category)], ann = FALSE) 564 | legend("top", legend = c("#ffb852", "#bfabcc", "#340059", "#1b3644"), horiz = TRUE, 565 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c329"), pch = 15, bty = "n") 566 | 567 | barplot(df_bar$y, col = sanzo.quad("c330"), main = "Combination 330", 568 | ylim = c(0, 20), border = NA) 569 | plot(df_scatter$value, pch = 18:20, 570 | col = sanzo.quad("c330") [unclass(df_scatter$category)], ann = FALSE) 571 | legend("top", legend = c("#bcd382", "#bfffe6", "#96bfe6", "#2dbc94"), horiz = TRUE, 572 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c330"), pch = 15, bty = "n") 573 | 574 | barplot(df_bar$y, col = sanzo.quad("c332"), main = "Combination 332", 575 | ylim = c(0, 20), border = NA) 576 | plot(df_scatter$value, pch = 18:20, 577 | col = sanzo.quad("c332") [unclass(df_scatter$category)], ann = FALSE) 578 | legend("top", legend = c("#ff7399", "#d50c42", "#172713", "#00592e"), horiz = TRUE, 579 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c332"), pch = 15, bty = "n") 580 | 581 | barplot(df_bar$y, col = sanzo.quad("c339"), main = "Combination 339", 582 | ylim = c(0, 20), border = NA) 583 | plot(df_scatter$value, pch = 18:20, 584 | col = sanzo.quad("c339") [unclass(df_scatter$category)], ann = FALSE) 585 | legend("top", legend = c("#d99e73", "#de4500", "#a6e6db", "#202d85"), horiz = TRUE, 586 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c339"), pch = 15, bty = "n") 587 | 588 | barplot(df_bar$y, col = sanzo.quad("c341"), main = "Combination 341", 589 | ylim = c(0, 20), border = NA) 590 | plot(df_scatter$value, pch = 18:20, 591 | col = sanzo.quad("c341") [unclass(df_scatter$category)], ann = FALSE) 592 | legend("top", legend = c("#ff616b", "#328e13", "#172713", "#a6e6db"), horiz = TRUE, 593 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c341"), pch = 15, bty = "n") 594 | 595 | barplot(df_bar$y, col = sanzo.quad("c348"), main = "Combination 348", 596 | ylim = c(0, 20), border = NA) 597 | plot(df_scatter$value, pch = 18:20, 598 | col = sanzo.quad("c348") [unclass(df_scatter$category)], ann = FALSE) 599 | legend("top", legend = c("#bcd382", "#328e13", "#172713", "#340059"), horiz = TRUE, 600 | xpd = TRUE, inset = c(-0.24), col = sanzo.quad("c348"), pch = 15, bty = "n") 601 | 602 | } 603 | 604 | # Print demos for all palettes in package. 605 | demo.all <- function() { 606 | demo2() 607 | demo3() 608 | demo4() 609 | } 610 | 611 | # Print information associated with duo palettes. 612 | # Hexadecimals 613 | # Color names 614 | # Palette name in Sanzo Wada site 615 | sanzo.info2 <- function() { 616 | 617 | long_names <- c("Combination 6", "Combination 7", "Combination 8", "Combination 33", 618 | "Combination 35", "Combination 47", "Combination 70", "Combination 71", 619 | "Combination 74", "Combination 79", "Combination 85", "Combination 91", 620 | "Combination 95", "Combination 102", "Combination 103", "Combination 106", 621 | "Combination 114", "Combination 118", "Combination 119", "Combination 229") 622 | short_names <- c("c006", "c007", "c008", "c033", "c035", "c047", "c070", "c071", "c074", "c079", 623 | "c085", "c091", "c095", "c102", "c103", "c106", "c114", "c118", "c119", "c229") 624 | hex <- c("#ff616b, #000831", "#ff5200, #b3e8c2", "#c2612c, #b8b8ff", "#b85e00, #1b3644", 625 | "#b08699, #a10b2b", "#c9303e, #bfabcc", "#b85e00, #405416", "#a90636, #d99e73", 626 | "#b5ffc2, #2dbc94", "#651300, #2dbc94", "#c74300, #008aa1", "#5c2c45, #c05200", 627 | "#681916, #06004f", "#ebd999, #c05200", "#c2612c, #2d0060", "#008aa1, #06004f", 628 | "#ffab00, #008aa1", "#e0b81f, #362304", "#a6e6db, #0d2b52", "#172713, #b5d1cc") 629 | url <- c("https://sanzo-wada.dmbk.io/combination/6", "https://sanzo-wada.dmbk.io/combination/7", 630 | "https://sanzo-wada.dmbk.io/combination/8", "https://sanzo-wada.dmbk.io/combination/33", 631 | "https://sanzo-wada.dmbk.io/combination/35", "https://sanzo-wada.dmbk.io/combination/47", 632 | "https://sanzo-wada.dmbk.io/combination/70", "https://sanzo-wada.dmbk.io/combination/71", 633 | "https://sanzo-wada.dmbk.io/combination/74", "https://sanzo-wada.dmbk.io/combination/79", 634 | "https://sanzo-wada.dmbk.io/combination/85", "https://sanzo-wada.dmbk.io/combination/91", 635 | "https://sanzo-wada.dmbk.io/combination/95", "https://sanzo-wada.dmbk.io/combination/102", 636 | "https://sanzo-wada.dmbk.io/combination/103", "https://sanzo-wada.dmbk.io/combination/106", 637 | "https://sanzo-wada.dmbk.io/combination/114", "https://sanzo-wada.dmbk.io/combination/118", 638 | "https://sanzo-wada.dmbk.io/combination/119", "https://sanzo-wada.dmbk.io/combination/229") 639 | 640 | df <- data.frame(long_names, short_names, hex, url) 641 | colnames(df) <- c("DUO PALETTE", "ID", "HEX VALUES", "URL") 642 | return(df) 643 | 644 | } 645 | 646 | # Print information associated with palette. 647 | # Hexadecimals 648 | # Color names 649 | # Palette name in Sanzo Wada site 650 | sanzo.info3 <- function() { 651 | 652 | long_names <- c("Combination 121", "Combination 139", "Combination 142", "Combination 148", 653 | "Combination 149", "Combination 157", "Combination 163", "Combination 171", 654 | "Combination 172", "Combination 174", "Combination 194", "Combination 204", 655 | "Combination 205", "Combination 207", "Combination 223", "Combination 226", 656 | "Combination 232", "Combination 239", "Combination 240", "Combination 343") 657 | short_names <- c("c121", "c139", "c142", "c148", "c149", "c157", "c163", "c171", "c172", "c174", 658 | "c194", "c204", "c205", "c207", "c223", "c226", "c232", "c239", "c240", "c343") 659 | hex <- c("#6c2b11, #d99e73, #405416", "#96bfe6, #000831, #b5d1cc", "#9e194d, #baa600, #96bfe6", 660 | "#d1bd19, #ffab00, #29bdad", "#d1bd19, #ff5200, #0f261f", "#6f0043, #d1bd19, #4f8fe6", 661 | "#ffe600, #b5ffc2, #008aa1", "#730f1f, #ff8c00, #b3e8c2", "#c2612c, #008aa1, #3400a3", 662 | "#ffa6d9, #bfabcc, #6b2e63", "#fa2b00, #ffcfc4, #4f8fe6", "#b319ab, #c2612c, #a6e6db", 663 | "#730f1f, #f59994, #2619d1", "#9b5348, #b3e8c2, #000000", "#b08699, #d99e73, #b5ffc2", 664 | "#5c2c45, #ffb852, #2619d1", "#d60036, #f2ad78, #000831", "#b08699, #c4bf33, #b3e8c2", 665 | "#ff788c, #ffff00, #29bdad", "#a93400, #ebd999, #505423") 666 | url <- c("https://sanzo-wada.dmbk.io/combination/121", "https://sanzo-wada.dmbk.io/combination/139", 667 | "https://sanzo-wada.dmbk.io/combination/142", "https://sanzo-wada.dmbk.io/combination/148", 668 | "https://sanzo-wada.dmbk.io/combination/149", "https://sanzo-wada.dmbk.io/combination/157", 669 | "https://sanzo-wada.dmbk.io/combination/163", "https://sanzo-wada.dmbk.io/combination/171", 670 | "https://sanzo-wada.dmbk.io/combination/172", "https://sanzo-wada.dmbk.io/combination/174", 671 | "https://sanzo-wada.dmbk.io/combination/194", "https://sanzo-wada.dmbk.io/combination/204", 672 | "https://sanzo-wada.dmbk.io/combination/205", "https://sanzo-wada.dmbk.io/combination/207", 673 | "https://sanzo-wada.dmbk.io/combination/223", "https://sanzo-wada.dmbk.io/combination/226", 674 | "https://sanzo-wada.dmbk.io/combination/232", "https://sanzo-wada.dmbk.io/combination/239", 675 | "https://sanzo-wada.dmbk.io/combination/240", "https://sanzo-wada.dmbk.io/combination/343") 676 | 677 | df <- data.frame(long_names, short_names, hex, url) 678 | colnames(df) <- c("TRIO PALETTE", "ID", "HEX VALUES", "URL") 679 | return(df) 680 | 681 | } 682 | 683 | # Print information associated with palette. 684 | # Hexadecimals 685 | # Color names 686 | # Palette name in Sanzo Wada site 687 | sanzo.info4 <- function() { 688 | 689 | long_names <- c("Combination 249", "Combination 252", "Combination 263", "Combination 268", 690 | "Combination 271", "Combination 273", "Combination 279", "Combination 283", 691 | "Combination 289", "Combination 293", "Combination 296", "Combination 302", 692 | "Combination 310", "Combination 321", "Combination 329", "Combination 330", 693 | "Combination 332", "Combination 339", "Combination 341", "Combination 348") 694 | short_names <- c("c249", "c252", "c263", "c268", "c271", "c273", "c279", "c283", "c289", "c293", 695 | "c296", "c302", "c310", "c321", "c329", "c330", "c332", "c339", "c341", "c348") 696 | hex <- c("#681916, #c0b490, #d1bd19, #417777", "#e62e73, #b85e00, #baa600, #2dbc94", 697 | "#a93400, #f2ad78, #b5ffc2, #1b3644", "#b08699, #b85e00, #172713, #bfffe6", 698 | "#b90078, #94ff94, #2dbc94, #0f261f", "#ffb3f0, #6f0043, #9b5348, #b5d1cc", 699 | "#b85e00, #f59994, #c0b490, #0d2b52", "#a7374b, #730f1f, #85b857, #6bffb3", 700 | "#f2ff26, #bdf226, #202d85, #06004f", "#b85e00, #b5ffc2, #65a98f, #40c945", 701 | "#f5f5b8, #d99e73, #5e4017, #1b3644", "#ffb852, #c0b490, #bfffe6, #008aa1", 702 | "#f5f5b8, #f2ad78, #718600, #172713", "#b08699, #f5f5b8, #172713, #96bfe6", 703 | "#ffb852, #bfabcc, #340059, #1b3644", "#bcd382, #bfffe6, #96bfe6, #2dbc94", 704 | "#ff7399, #d50c42, #172713, #00592e", "#d99e73, #de4500, #a6e6db, #202d85", 705 | "#ff616b, #328e13, #172713, #a6e6db", "#bcd382, #328e13, #172713, #340059") 706 | url <- c("https://sanzo-wada.dmbk.io/combination/249", "https://sanzo-wada.dmbk.io/combination/252", 707 | "https://sanzo-wada.dmbk.io/combination/263", "https://sanzo-wada.dmbk.io/combination/268", 708 | "https://sanzo-wada.dmbk.io/combination/271", "https://sanzo-wada.dmbk.io/combination/273", 709 | "https://sanzo-wada.dmbk.io/combination/279", "https://sanzo-wada.dmbk.io/combination/283", 710 | "https://sanzo-wada.dmbk.io/combination/289", "https://sanzo-wada.dmbk.io/combination/293", 711 | "https://sanzo-wada.dmbk.io/combination/296", "https://sanzo-wada.dmbk.io/combination/302", 712 | "https://sanzo-wada.dmbk.io/combination/310", "https://sanzo-wada.dmbk.io/combination/321", 713 | "https://sanzo-wada.dmbk.io/combination/329", "https://sanzo-wada.dmbk.io/combination/330", 714 | "https://sanzo-wada.dmbk.io/combination/332", "https://sanzo-wada.dmbk.io/combination/339", 715 | "https://sanzo-wada.dmbk.io/combination/341", "https://sanzo-wada.dmbk.io/combination/348") 716 | 717 | df <- data.frame(long_names, short_names, hex, url) 718 | colnames(df) <- c("QUAD PALETTE", "ID", "HEX VALUES", "URL") 719 | return(df) 720 | 721 | } 722 | 723 | # Print information associated with palette. 724 | # Hexadecimals 725 | # Color names 726 | # Palette name in Sanzo Wada site 727 | sanzo.info.all <- function() { 728 | 729 | d <- sanzo.info2() 730 | t <- sanzo.info3() 731 | q <- sanzo.info4() 732 | 733 | df <- merge(d, t, all = TRUE) 734 | df <- merge(df, q, all = TRUE) 735 | return(df) 736 | 737 | } 738 | 739 | knitr::kable(sanzo.info2()) 740 | knitr::kable(sanzo.info3()) 741 | knitr::kable(sanzo.info4()) 742 | 743 | 744 | 745 | ``` 746 | 747 | # Demo duos in base R. 748 | 749 | ```{r demoDuos, echo = FALSE} 750 | 751 | demo2() 752 | 753 | ``` 754 | 755 | # Demo trios in base R. 756 | 757 | ```{r demoTrios, echo = FALSE} 758 | 759 | demo3() 760 | 761 | ``` 762 | 763 | # Demo quads in base R. 764 | 765 | ```{r demoQuad, echo = FALSE} 766 | 767 | demo4() 768 | 769 | ``` 770 | 771 | # Demo in ggplot2. 772 | 773 | ## Scatter plots. 774 | 775 | ### Combination 205 776 | #### theme_tufte (ggthemes), geom_rug, alpha = 3/4. 777 | 778 | ```{r gg_scatter1, echo = FALSE, warning = FALSE} 779 | 780 | ggplot(raw, aes(CT1, CT2, color = as.factor(Concentration))) + 781 | geom_point(aes(shape = Target), 782 | size = 2, 783 | alpha = 3/4) + 784 | geom_rug() + 785 | theme_tufte(ticks = FALSE) + 786 | scale_color_manual(name = "PLASMID CONCENTRATION", 787 | values = sanzo.trio("c205")) + 788 | scale_shape_manual(name = "TARGET", 789 | values = c(17, 18, 19)) + 790 | theme(axis.text = element_text(size = 8), 791 | axis.title = element_text(size = 10), 792 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 793 | legend.title = element_text(size = 10)) + 794 | labs(y = "REPLICATE 2\n", 795 | x = "\nREPLICATE 1", 796 | fill = "TARGET", 797 | title = "MEAN PLASMID CONTROL Cq VALUE BY qPCR TARGET\n") + 798 | geom_smooth(method = lm, 799 | se = FALSE, 800 | color = "darkslategray", 801 | size = 0.5) + 802 | scale_y_continuous(limits = c(15, 35)) + 803 | scale_x_continuous(limits = c(15, 35)) + 804 | geom_abline(intercept = 0, 805 | slope = 1, 806 | linetype = "dotted", 807 | color = "ivory3") 808 | 809 | ``` 810 | 811 | ### Combination 194 812 | #### theme_tufte (ggthemes), geom_rug, alpha = 3/4. 813 | 814 | ```{r gg_scatter2, echo = FALSE, warning = FALSE} 815 | ggplot(raw, aes(CT1, CT2, color = as.factor(Concentration))) + 816 | geom_point(aes(shape = Target), 817 | size = 2, 818 | alpha = 3/4) + 819 | geom_rug() + 820 | theme_tufte(ticks = FALSE) + 821 | scale_color_manual(name = "PLASMID CONCENTRATION", 822 | values = sanzo.trio("c194")) + 823 | scale_shape_manual(name = "TARGET", 824 | values = c(17, 18, 19)) + 825 | theme(axis.text = element_text(size = 8), 826 | axis.title = element_text(size = 10), 827 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 828 | legend.title = element_text(size = 10)) + 829 | labs(y = "REPLICATE 2\n", 830 | x = "\nREPLICATE 1", 831 | fill = "TARGET", 832 | title = "MEAN PLASMID CONTROL Cq VALUE BY qPCR TARGET\n") + 833 | geom_smooth(method = lm, 834 | se = FALSE, 835 | color = "darkslategray", 836 | size = 0.5) + 837 | scale_y_continuous(limits = c(15, 35)) + 838 | scale_x_continuous(limits = c(15, 35)) + 839 | geom_abline(intercept = 0, 840 | slope = 1, 841 | linetype = "dotted", 842 | color = "ivory3") 843 | 844 | ``` 845 | 846 | ### Combination 121 847 | #### theme_tufte (ggthemes), geom_rug, alpha = 3/4. 848 | 849 | ```{r gg_scatter3, echo = FALSE, warning = FALSE} 850 | ggplot(raw, aes(CT1, CT2, color = as.factor(Concentration))) + 851 | geom_point(aes(shape = Target), 852 | size = 2, 853 | alpha = 3/4) + 854 | geom_rug() + 855 | theme_tufte(ticks = FALSE) + 856 | scale_color_manual(name = "PLASMID CONCENTRATION", 857 | values = sanzo.trio("c121")) + 858 | scale_shape_manual(name = "TARGET", 859 | values = c(17, 18, 19)) + 860 | theme(axis.text = element_text(size = 8), 861 | axis.title = element_text(size = 10), 862 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 863 | legend.title = element_text(size = 10)) + 864 | labs(y = "REPLICATE 2\n", 865 | x = "\nREPLICATE 1", 866 | fill = "TARGET", 867 | title = "MEAN PLASMID CONTROL Cq VALUE BY qPCR TARGET\n") + 868 | geom_smooth(method = lm, 869 | se = FALSE, 870 | color = "darkslategray", 871 | size = 0.5) + 872 | scale_y_continuous(limits = c(15, 35)) + 873 | scale_x_continuous(limits = c(15, 35)) + 874 | geom_abline(intercept = 0, 875 | slope = 1, 876 | linetype = "dotted", 877 | color = "ivory3") 878 | 879 | ``` 880 | 881 | ### Combination 207 882 | #### theme_tufte (ggthemes), geom_rug, alpha = 3/4. 883 | 884 | ```{r gg_scatter4, echo = FALSE, warning = FALSE} 885 | 886 | ggplot(raw, aes(CT1, CT2, color = as.factor(Concentration))) + 887 | geom_point(aes(shape = Target), 888 | size = 2, 889 | alpha = 3/4) + 890 | geom_rug() + 891 | theme_tufte(ticks = FALSE) + 892 | scale_color_manual(name = "PLASMID CONCENTRATION", 893 | values = sanzo.trio("c207")) + 894 | scale_shape_manual(name = "TARGET", 895 | values = c(17, 18, 19)) + 896 | theme(axis.text = element_text(size = 8), 897 | axis.title = element_text(size = 10), 898 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 899 | legend.title = element_text(size = 10)) + 900 | labs(y = "REPLICATE 2\n", 901 | x = "\nREPLICATE 1", 902 | fill = "TARGET", 903 | title = "MEAN PLASMID CONTROL Cq VALUE BY qPCR TARGET\n") + 904 | geom_smooth(method = lm, 905 | se = FALSE, 906 | color = "darkslategray", 907 | size = 0.5) + 908 | scale_y_continuous(limits = c(15, 35)) + 909 | scale_x_continuous(limits = c(15, 35)) + 910 | geom_abline(intercept = 0, 911 | slope = 1, 912 | linetype = "dotted", 913 | color = "ivory3") 914 | 915 | ``` 916 | 917 | 918 | ### Combination 172 919 | #### theme_tufte (ggpthemes), geom_rug, alpha = 3/4. 920 | 921 | ```{r gg_scatter5, echo = FALSE, warning = FALSE} 922 | 923 | ggplot(raw, aes(CT1, CT2, color = as.factor(Concentration))) + 924 | geom_point(aes(shape = Target), 925 | size = 2, 926 | alpha = 3/4) + 927 | geom_rug() + 928 | theme_tufte(ticks = FALSE) + 929 | scale_color_manual(name = "PLASMID CONCENTRATION", 930 | values = sanzo.trio("c172")) + 931 | scale_shape_manual(name = "TARGET", 932 | values = c(17, 18, 19)) + 933 | theme(axis.text = element_text(size = 8), 934 | axis.title = element_text(size = 10), 935 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 936 | legend.title = element_text(size = 10)) + 937 | labs(y = "REPLICATE 2\n", 938 | x = "\nREPLICATE 1", 939 | fill = "TARGET", 940 | title = "MEAN PLASMID CONTROL Cq VALUE BY qPCR TARGET\n") + 941 | geom_smooth(method = lm, 942 | se = FALSE, 943 | color = "darkslategray", 944 | size = 0.5) + 945 | scale_y_continuous(limits = c(15, 35)) + 946 | scale_x_continuous(limits = c(15, 35)) + 947 | geom_abline(intercept = 0, 948 | slope = 1, 949 | linetype = "dotted", 950 | color = "ivory3") 951 | 952 | ``` 953 | 954 | ## Violin plots. 955 | #### theme_hc (ggthemes), grid-up via cowplot. 956 | 957 | ```{r violin, echo = FALSE, warning = FALSE} 958 | 959 | x1 <- rnorm(40, mean = 80.2, sd = 4) 960 | x2 <- rnorm(20, mean = 75.3, sd = 5) 961 | x3 <- rnorm(30, mean = 63.3, sd = 4) 962 | x4 <- rnorm(20, mean = 55.8, sd = 3) 963 | 964 | y1 <- rnorm(40, mean = 55.8, sd = 3) 965 | y2 <- rnorm(20, mean = 63.3, sd = 4) 966 | y3 <- rnorm(30, mean = 55.8, sd = 5) 967 | y4 <- rnorm(20, mean = 80.2, sd = 4) 968 | 969 | x <- c(x1, x2, x3, x4) 970 | y <- c(y1, y2, y3, y4) 971 | 972 | category <- c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 973 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 974 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 975 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 976 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 977 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4) 978 | 979 | df_scatter <- data.frame(x, y, category) 980 | 981 | vio1 <- ggplot(df_scatter, aes(category, x), color = as.factor(category)) + 982 | geom_violin(aes(fill = factor(category)), trim = FALSE) + 983 | theme_hc() + 984 | scale_fill_manual(name = "", 985 | values = sanzo.quad("c321")) + 986 | scale_color_manual(name = "", 987 | values = sanzo.quad("c321")) + 988 | theme(axis.text = element_text(size = 8), 989 | axis.title = element_text(size = 10), 990 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 991 | legend.position = "none") + 992 | labs(y = "", 993 | x = "\nCombination 321", 994 | fill = "", 995 | title = "") + 996 | theme(aspect.ratio = 1) 997 | 998 | 999 | vio2 <- ggplot(df_scatter, aes(category, x), color = as.factor(category)) + 1000 | geom_violin(aes(fill = factor(category)), trim = FALSE) + 1001 | theme_hc() + 1002 | scale_fill_manual(name = "", 1003 | values = sanzo.quad("c339")) + 1004 | scale_color_manual(name = "", 1005 | values = sanzo.quad("c339")) + 1006 | theme(axis.text = element_text(size = 8), 1007 | axis.title = element_text(size = 10), 1008 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 1009 | legend.position = "none") + 1010 | labs(y = "", 1011 | x = "\nCombination 339", 1012 | fill = "", 1013 | title = "") + 1014 | theme(aspect.ratio = 1) 1015 | 1016 | 1017 | plot_grid(vio1, vio2) 1018 | 1019 | ``` 1020 | 1021 | ## Concatenating two duos for a custom quad. 1022 | #### theme_hc (ggthemes), alpha = 5/6. 1023 | 1024 | ```{r concat, echo = FALSE, message = FALSE, warning = FALSE} 1025 | c033 <- sanzo.duo("c033") 1026 | c095 <- sanzo.duo("c095") 1027 | custom <- c(c033, c095) 1028 | 1029 | ggplot(df_scatter, aes(category, x), color = as.factor(category)) + 1030 | geom_violin(aes(fill = factor(category)), alpha = 5/6, trim = FALSE) + 1031 | theme_hc() + 1032 | scale_fill_manual(name = "", 1033 | values = custom) + 1034 | scale_color_manual(name = "", 1035 | values = custom) + 1036 | theme(axis.text = element_text(size = 8), 1037 | axis.title = element_text(size = 10), 1038 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 1039 | legend.position = "none") + 1040 | labs(y = "", 1041 | x = "\nCombination 033 + Combination 095", 1042 | fill = "", 1043 | title = "") + 1044 | theme(aspect.ratio = 1) 1045 | 1046 | ``` 1047 | 1048 | ## Gradient. 1049 | #### Continuous colors via scale_fill_gradientn(), theme_few (ggthemes). 1050 | 1051 | ```{r gradient, echo = FALSE, warning = FALSE} 1052 | 1053 | grad1 <- ggplot(faithfuld, aes(waiting, eruptions)) + 1054 | geom_raster(aes(fill = density), interpolate = TRUE) + 1055 | theme_few() + 1056 | scale_fill_gradientn(colors = sanzo.duo("c114")) + 1057 | labs(y = "", 1058 | x = "", 1059 | fill = "", 1060 | title = "Combination 114\n") 1061 | 1062 | grad2 <- ggplot(faithfuld, aes(waiting, eruptions)) + 1063 | geom_raster(aes(fill = density), interpolate = TRUE) + 1064 | theme_few() + 1065 | scale_fill_gradientn(colors = sanzo.trio("c163")) + 1066 | labs( y= "", 1067 | x = "", 1068 | fill = "", 1069 | title = "Combination 163\n") 1070 | 1071 | grad3 <- ggplot(faithfuld, aes(waiting, eruptions)) + 1072 | geom_raster(aes(fill = density), interpolate = TRUE) + 1073 | theme_few() + 1074 | scale_fill_gradientn(colors = sanzo.trio("c171")) + 1075 | labs(y = "", 1076 | x = "", 1077 | fill = "", 1078 | title = "Combination 171\n") 1079 | 1080 | grad4 <- ggplot(faithfuld, aes(waiting, eruptions)) + 1081 | geom_raster(aes(fill = density), interpolate = TRUE) + 1082 | theme_few() + 1083 | scale_fill_gradientn(colors = sanzo.duo("c102")) + 1084 | labs(y = "", 1085 | x = "", 1086 | fill = "", 1087 | title = "Combination 102\n") 1088 | 1089 | plot_grid(grad1, grad2, grad3, grad4) 1090 | 1091 | ``` 1092 | 1093 | ## Bar plots. 1094 | 1095 | #### theme_tufte (ggthemes). 1096 | 1097 | ```{r gg_bar1, echo = FALSE, warning = FALSE} 1098 | 1099 | bar1 <- ggplot(mean, aes(fill = Concentration, y = CT, x = Target)) + 1100 | geom_bar(position = "dodge", stat = "identity") + 1101 | theme_tufte() + 1102 | scale_fill_manual(values = sanzo.trio("c343")) + 1103 | theme(axis.text = element_text(size = 8), 1104 | axis.title = element_text(size = 10), 1105 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 1106 | legend.title = element_text(size = 10), 1107 | legend.position = "right", 1108 | legend.direction = "vertical") + 1109 | labs(y = "", 1110 | x = "", 1111 | fill = "", 1112 | title = "") 1113 | 1114 | 1115 | bar2 <- ggplot(mean, aes(fill = Concentration, y = CT, x = Target)) + 1116 | geom_bar(position = "dodge", stat = "identity") + 1117 | theme_tufte() + 1118 | scale_fill_manual(values = sanzo.quad("c252")) + 1119 | theme(axis.text = element_text(size = 8), 1120 | axis.title = element_text(size = 10), 1121 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 1122 | legend.title = element_text(size = 10), 1123 | legend.position = "right", 1124 | legend.direction = "vertical") + 1125 | labs(y = "", 1126 | x = "", 1127 | fill = "", 1128 | title = "") 1129 | 1130 | 1131 | bar3 <- ggplot(mean, aes(fill = Concentration, y = CT, x = Target)) + 1132 | geom_bar(position = "dodge", stat = "identity") + 1133 | theme_tufte() + 1134 | scale_fill_manual(values = c(sanzo.duo("c035"), sanzo.duo("c079"))) + 1135 | theme(axis.text = element_text(size = 8), 1136 | axis.title = element_text(size = 10), 1137 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 1138 | legend.title = element_text(size = 10), 1139 | legend.position = "right", 1140 | legend.direction = "vertical") + 1141 | labs(y = "", 1142 | x = "", 1143 | fill = "", 1144 | title = "") 1145 | 1146 | 1147 | bar4 <- ggplot(mean, aes(fill = Concentration, y = CT, x = Target)) + 1148 | geom_bar(position = "dodge", stat = "identity") + 1149 | theme_tufte() + 1150 | scale_fill_manual(values = sanzo.quad("c310")) + 1151 | theme(axis.text = element_text(size = 8), 1152 | axis.title = element_text(size = 10), 1153 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 1154 | legend.title = element_text(size = 10), 1155 | legend.position = "right", 1156 | legend.direction = "vertical") + 1157 | labs(y = "", 1158 | x = "", 1159 | fill = "", 1160 | title = "") 1161 | 1162 | plot_grid(bar1, bar2, bar3, bar4, labels = c("Combination 343", "Combination 252", "Combinations 35 + 79", "Combination 310"), label_size = 12) 1163 | 1164 | ``` 1165 | 1166 | #### theme_few (ggthemes). 1167 | 1168 | ```{r gg_bar2, echo = FALSE, warning = FALSE} 1169 | 1170 | bar1 <- ggplot(mean, aes(fill = Concentration, y = CT, x = Target)) + 1171 | geom_bar(stat = "identity") + 1172 | theme_few() + 1173 | scale_fill_manual(values = sanzo.trio("c239"), labels = c("A", "B", "C")) + 1174 | theme(axis.text = element_text(size = 8), 1175 | axis.title = element_text(size = 10), 1176 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 1177 | legend.title = element_text(size = 10), 1178 | legend.position = "right", 1179 | legend.direction = "vertical") + 1180 | scale_x_discrete(labels = c("1", "2", "3")) + 1181 | labs(y = "", 1182 | x = "", 1183 | fill = "", 1184 | title = "") 1185 | 1186 | 1187 | bar2 <- ggplot(mean, aes(fill = Concentration, y = CT, x = Target)) + 1188 | geom_bar(stat = "identity") + 1189 | theme_few() + 1190 | scale_fill_manual(values = sanzo.trio("c157"), labels = c("A", "B", "C")) + 1191 | theme(axis.text = element_text(size = 8), 1192 | axis.title = element_text(size = 10), 1193 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 1194 | legend.title = element_text(size = 10), 1195 | legend.position = "right", 1196 | legend.direction = "vertical") + 1197 | scale_x_discrete(labels = c("1", "2", "3")) + 1198 | labs(y = "", 1199 | x = "", 1200 | fill = "", 1201 | title = "") 1202 | 1203 | 1204 | 1205 | bar3 <- ggplot(mean, aes(fill = Concentration, y = CT, x = Target)) + 1206 | geom_bar(stat = "identity") + 1207 | theme_few() + 1208 | scale_fill_manual(values = sanzo.quad("c348"), labels = c("A", "B", "C")) + 1209 | theme(axis.text = element_text(size = 8), 1210 | axis.title = element_text(size = 10), 1211 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 1212 | legend.title = element_text(size = 10), 1213 | legend.position = "right", 1214 | legend.direction = "vertical") + 1215 | scale_x_discrete(labels = c("1", "2", "3")) + 1216 | labs(y = "", 1217 | x = "", 1218 | fill = "", 1219 | title = "") 1220 | 1221 | 1222 | bar4 <- ggplot(mean, aes(fill = Concentration, y = CT, x = Target)) + 1223 | geom_bar(stat = "identity") + 1224 | theme_few() + 1225 | scale_fill_manual(values = sanzo.quad("c268"), labels = c("A", "B", "C")) + 1226 | theme(axis.text = element_text(size = 8), 1227 | axis.title = element_text(size = 10), 1228 | plot.title = element_text(size = 10, face = "bold", hjust = 0.5), 1229 | legend.title = element_text(size = 10), 1230 | legend.position = "right", 1231 | legend.direction = "vertical") + 1232 | scale_x_discrete(labels = c("1", "2", "3")) + 1233 | labs(y = "", 1234 | x = "", 1235 | fill = "", 1236 | title = "") 1237 | 1238 | plot_grid(bar1, bar2, bar3, bar4, labels = c("Combination 239", "Combination 157", "Combination 348", "Combination 268"), label_size = 12) 1239 | 1240 | ``` 1241 | --------------------------------------------------------------------------------