Helper functions to generate grid for color-vision deficiency (CVD) possibilities. These functions do the same thing, but have different default values.

pth_cvd_grid(condition = c("none", "deutan", "protan", "tritan"), severity = 1)

pth_cvd_grid_full(
  condition = c("deutan", "protan", "tritan"),
  severity = c(0, 0.33, 0.67, 1)
)

pth_cvd_grid_none(condition = "none", severity = 0)

pth_cvd_grid_severity(severity = 1)

pth_cvd_grid_deupro(
  condition = c("deutan", "protan"),
  severity = seq(0, 1, by = 0.1)
)

Arguments

condition

character one or more color-vision deficiency conditions; legal values: "none", "deutan", "protan", "tritan".

severity

double one or more values of severity for a given condition; legal values from 0 to 1.

Value

tbl_df with columns cvd (factor), severity (double)

Details

pth_cvd_grid()

All cases, including "none", at maximum severity.

pth_cvd_grid_full()

All CVD cases, at four values of severity.

pth_cvd_grid_none()

No CVD cases, zero severity.

pth_cvd_grid_severity()

Useful for evaluating performance of categorical palettes, concatenates result of pth_cvd_grid_none() with pth_cvd_grid_severity()

.
pth_cvd_grid_deupro()

Useful for choosing colors in categorical palettes, Deutan and Protan CVD cases, severity from zero to one.

Examples

  pth_cvd_grid_none()
#> # A tibble: 1 × 2
#>   condition severity
#>   <fct>        <dbl>
#> 1 none             0
  pth_cvd_grid_full()
#> # A tibble: 12 × 2
#>    condition severity
#>    <fct>        <dbl>
#>  1 deutan        0   
#>  2 protan        0   
#>  3 tritan        0   
#>  4 deutan        0.33
#>  5 protan        0.33
#>  6 tritan        0.33
#>  7 deutan        0.67
#>  8 protan        0.67
#>  9 tritan        0.67
#> 10 deutan        1   
#> 11 protan        1   
#> 12 tritan        1   
  pth_cvd_grid_severity(0.9)
#> # A tibble: 4 × 2
#>   condition severity
#>   <fct>        <dbl>
#> 1 none           0  
#> 2 deutan         0.9
#> 3 protan         0.9
#> 4 tritan         0.9