Title: | Government Analysis Function Recommended Accessible Colour Palette |
Version: | 1.0.0 |
Description: | Government Analysis Function recommended colours for use in charts on gov.uk to help meet accessibility guidance. |
License: | MIT + file LICENSE |
Depends: | R (≥ 2.10) |
Imports: | dplyr, grDevices |
Suggests: | ggplot2, testthat (≥ 3.0.0) |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2023-09-06 08:37:26 UTC; daviel9 |
Author: | Luke Davies [aut, cre], Charlotte Rowley [aut], The Office for National Statistics [cph] |
Maintainer: | Luke Davies <Luke.Davies@ons.gov.uk> |
Repository: | CRAN |
Date/Publication: | 2023-09-06 18:12:32 UTC |
Analysis Function colour palette function
Description
Generate a colour palette based on the selected chart and colour_format type (hex/rgb).
Usage
af_colours(
type = c("categorical", "duo", "sequential", "focus"),
colour_format = "hex",
n = 6
)
Arguments
type |
Name of required palette. Choices are:
|
colour_format |
Type of colour code to return. Choices are:
|
n |
Number of colours to return for categorical palette type (max 6). If omitted, uses all colours. |
Value
A vector of colour codes
Examples
data <- data.frame(x = c(1,2),
y = c(1,2),
z = c("a","b")
)
ggplot2::ggplot(data, ggplot2::aes(x = x, y = y, colour = z)) +
ggplot2::geom_point() +
ggplot2::scale_colour_manual(values = af_colours("duo"))