diff --git a/DESCRIPTION b/DESCRIPTION index 48da1c3..3a62e6e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -14,7 +14,7 @@ Authors@R: c( ) Description: Color palettes for all people, including those with color vision deficiency. Popular color palette series have been organized by type and have been scored on several properties such as color-blind-friendliness and fairness (i.e. do colors stand out equally?). Own palettes can also be loaded and analysed. Besides the common palette types (categorical, sequential, and diverging) it also includes bivariate color palettes. Furthermore, a color for missing values is assigned to each palette. Version: 0.7 -Date: 2024-02-29 +Date: 2024-03-01 Encoding: UTF-8 Depends: R (>= 3.5.0), diff --git a/R/c4a_gui.R b/R/c4a_gui.R index c4a7711..ca13c6c 100644 --- a/R/c4a_gui.R +++ b/R/c4a_gui.R @@ -333,7 +333,7 @@ c4a_gui = function(type = "cat", n = NA, series = "all") { shiny::fluidRow( shiny::column(width = 12, shiny::selectizeInput("namePal", "Palette", choices = init_pal_list), - infoBoxUI("infoName", "Naming table"), + infoBoxUI("infoName", "Naming table (in development)"), plotOverlay("anaName", width = "1000px", height = "600px", "aniName"))), #shiny::plotOutput("namePlot", height = "600px", width = "1000px"))), shiny::fluidRow( diff --git a/R/c4a_modify.R b/R/c4a_modify.R index 208d5f6..087c3d3 100644 --- a/R/c4a_modify.R +++ b/R/c4a_modify.R @@ -1,9 +1,9 @@ -#' Edit cols4all palettes +#' Edit cols4all palettes (in development) #' #' Edit cols4all palettes. c4a_duplicate duplicates an existing cols4all palette, and c4a_modify is used to change the colors. Use c4a_data to craete palettes from scratch. #' #' @param palette name of the palette -#' @param x vector of the new colors. It should either the same length, or a named vector, where the names correspond to the index numbers. E.g. c("3" = "#AABBCC") will replace the third color with the color "#AABBCC". +#' @param x vector of the new colors. It should either the same length, or a named vector, where the names correspond to the index numbers. E.g. `c("3" = "#AABBCC")` will replace the third color with the color `"#AABBCC"`. #' @param xNA the new color for missing values. #' @rdname c4a_modify #' @name c4a_modify diff --git a/README.Rmd b/README.Rmd index b4174f2..780e8b4 100644 --- a/README.Rmd +++ b/README.Rmd @@ -40,7 +40,7 @@ knitr::knit_hooks$set(output = function(x, options) { [![cran checks](https://cranchecks.info/badges/worst/cols4all)](https://cran.r-project.org/web/checks/check_results_cols4all.html) [![Downloads](http://cranlogs.r-pkg.org/badges/cols4all?color=brightgreen)](http://www.r-pkg.org/pkg/cols4all) -The **cols4all** is a new R package for selecting color palettes. "Color for all" refers to our mission that colors should be usable for not just people with normal color vision, but also for people with color vision deficiency. Currently, this package contains palettes from several popular and lesser known color palette series. Own palettes series can be added as well. +**cols4all** is an R package for selecting color palettes. "Color for all" refers to our mission that colors should be usable for not just people with normal color vision, but also for people with color vision deficiency. Currently, this package contains palettes from several popular and lesser known color palette series. Own palettes series can be added as well. Color palettes are well organized and made consistent with each other. Moreover, they are scored on several aspects: color-blind-friendliness, the presence of intense colors (which should be avoided), the overall aesthetic harmony, and how many different hues are used. Finally, for each color palette a color for missing values is assigned, which is especially important for spatial data visualization. Currently we support several types: *categorical* (qualitative) palettes, *sequential* palettes, *diverging* palettes, and *bivariate* palettes (divided into four subtypes). @@ -78,7 +78,7 @@ The main tool is a dashboard, which is started with: c4a_gui() ``` -![https://user-images.githubusercontent.com/2444081/210850914-cdb8a128-1b8a-4900-94d0-dfa6ca449585.png](https://user-images.githubusercontent.com/2444081/210850914-cdb8a128-1b8a-4900-94d0-dfa6ca449585.png) +[](figures/cols4all_table3.png) What types and series are available? @@ -168,6 +168,11 @@ Importing and exporting palettes: * `c4a_sysdata_import` Import system data * `c4a_sysdata_export` Export system data +Edit color palette data + +* `c4a_duplicate` Duplicates a color palette +* `c4a_modify` Modifies palette colors + ggplot2 * `scale___c4a_` e.g. `scale_color_continuous_c4a_div` Add scale to ggplot2. diff --git a/man/c4a_modify.Rd b/man/c4a_modify.Rd index 832530c..4e0bcd1 100644 --- a/man/c4a_modify.Rd +++ b/man/c4a_modify.Rd @@ -3,7 +3,7 @@ \name{c4a_modify} \alias{c4a_modify} \alias{c4a_duplicate} -\title{Edit cols4all palettes} +\title{Edit cols4all palettes (in development)} \usage{ c4a_modify(palette, x = NULL, xNA = NULL) @@ -12,7 +12,7 @@ c4a_duplicate(palette, name = NA) \arguments{ \item{palette}{name of the palette} -\item{x}{vector of the new colors. It should either the same length, or a named vector, where the names correspond to the index numbers. E.g. c("3" = "#AABBCC") will replace the third color with the color "#AABBCC".} +\item{x}{vector of the new colors. It should either the same length, or a named vector, where the names correspond to the index numbers. E.g. \code{c("3" = "#AABBCC")} will replace the third color with the color \code{"#AABBCC"}.} \item{xNA}{the new color for missing values.} diff --git a/vignettes/intro.Rmd b/vignettes/intro.Rmd index 05f528b..10a8160 100644 --- a/vignettes/intro.Rmd +++ b/vignettes/intro.Rmd @@ -47,15 +47,17 @@ library(cols4all) Color is essential in many charts and maps. There are a lot of color palettes to choose from: most visualization software tools have their own palettes and there are many other series of color palettes, such as ColorBrewer (Harrower and Brewer, 2003). To make life easier for R users, there are a couple of packages that contain a large collection of palettes, most notably `pals` (Wright, 2021) with 139 and `paletteer` (Hvitfeldt, 2021) with 2569 (!) palettes. However, people often cannot see the trees through the forest, so therefore they tend to stick with the color palettes they know, or with the most popular ones. -The `cols4all` package also contains a large collection of palettes (to be precise `r length(c4a_palettes())` at the time of writing), but with the central question: which palettes are good and why? There is no simple answer, since there are many aspects to take into account, which may have opposite effects. In `cols4all` we examine the following aspects: +The `cols4all` package also contains a large collection of palettes (to be precise `r length(c4a_palettes())` at the time of writing), but with the central question: **which palettes are good and why?** There is no simple answer, since there are many aspects to take into account, which may have opposite effects. In `cols4all` we examine the following aspects: -* **Color Blind Friendliness** First and most importantly, is a palette suitable for colorblind people? About 5% of all humans have a color vision deficiency, and we want to include them; hence the package name "colors for all". +* **Color Blind Friendliness** First and most importantly, is a palette suitable for colorblind people? About 1 out of 12 humans have a color vision deficiency, and we want to include them; hence the package name "colors for all". -* **HCL Analysis** Does a palette work well for statistical purposes? We analyse this with the HCL (hue-chroma-luminance) color space. Concrete questions for these analysis are the following. How vivid are colors? Do the colors stand out about equally (which we call "fairness")? What hue ranges are used for quantitative color palettes? +* **HCL Analysis** Does a palette work well for statistical purposes? We analyse this with the HCL (hue-chroma-luminance) color space. Concrete questions for these analysis are the following. How **vivid** are colors? Do the colors stand out about equally (which we call **fairness**)? What hue ranges are used for quantitative color palettes? -* **Contrast** What is the contrast between the colors in the palette? We focus on two specific questions: 1) How well is text readable (also for people with a visual impairment)? 2) Are border lines needed to separate colors? +* **Nameability** (in development) Easy to name colors are also easy to remember. Therefore, it is beneficial to use a color palette with easy nameable colors. + +* **Contrast** What is the contrast between the colors in the palette? We focus on two specific questions: 1) Is there sufficient contrast with the background color (usually white or black)? This is especially needed for text but also point- and line charts. 2) Are border lines needed to separate colors? * **3D Blues** Does the palette contain blue colors that could result in a floating effect? @@ -63,7 +65,7 @@ Currently, **cols4all** contains palettes from several popular and lesser known Color palettes are organized and made consistent with each other. For instance, all sequential palettes go from light to dark. Furthermore, for each color palette a color for missing values is assigned, which is especially important for spatial data visualization. Currently we support several types: *categorical* (qualitative) palettes, *sequential* palettes, *diverging* palettes, and *bivariate* palettes (divided into four subtypes). -[](https://user-images.githubusercontent.com/2444081/210850914-cdb8a128-1b8a-4900-94d0-dfa6ca449585.png) +[](cols4all_table3.png) The figure above shows the main tool of this package, a dashboard. The first tab page contains an overview table of all palettes (given the input selection criteria). The other tab pages are for further palette-wise analyses. @@ -204,6 +206,7 @@ Palette names and properties: * `.P` Environment via which palette names can be browsed with auto-completion (using `$`) + Importing and exporting palettes: * `c4a_data` Build color palette data @@ -211,6 +214,11 @@ Importing and exporting palettes: * `c4a_sysdata_import` Import system data * `c4a_sysdata_export` Export system data +Edit color palette data + +* `c4a_duplicate` Duplicates a color palette +* `c4a_modify` Modifies palette colors + ggplot2 * `scale___c4a_` e.g. `scale_color_continuous_c4a_div` Add scale to ggplot2. @@ -298,6 +306,10 @@ Regarding **Fairness** we consider two metrics: the luminance range (`Lrange`) a Note that harmonic color palettes are usually not color blind friendly. Furthermore, when the luminance values of the colors are about equal, the contrast of those colors is low, which requires the use of border lines (see below). +### Naming + +This property is still in development. Details will follow. + ### Contrast The border between two colored shapes appears **wobbly** when the colors are equally luminant (bright), no matter what hue (red, blue, etc.) they have. This visual illusion is called **equiluminance**.