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)
)
character
one or more color-vision deficiency conditions;
legal values: "none"
, "deutan"
, "protan"
, "tritan"
.
double
one or more values of severity for a given
condition; legal values from 0 to 1.
tbl_df
with columns cvd
(factor), severity
(double)
All cases, including "none", at maximum severity.
All CVD cases, at four values of severity.
No CVD cases, zero severity.
Useful for evaluating performance of
categorical palettes, concatenates result of pth_cvd_grid_none()
with
pth_cvd_grid_severity()
Useful for choosing colors in categorical palettes, Deutan and Protan CVD cases, severity from zero to one.
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