scale_correlaid: CorrelAid colour scales for ggplot2

scale_colour_correlaid_dR Documentation

CorrelAid colour scales for ggplot2

Description

Discrete, continuous and binned ggplot2 colour and fill scales based on the CorrelAid design guide. For a list of available palettes and colours see correlaid_pal(). Change the values of the ggplot2.continuous.colour and ggplot2.continuous.fill options() to set these scales as default in ggplot2 (see Details).

Usage

scale_colour_correlaid_d(direction = 1, option = "qualitative", ...)

scale_color_correlaid_d(direction = 1, option = "qualitative", ...)

scale_fill_correlaid_d(direction = 1, option = "qualitative", ...)

scale_colour_correlaid_c(
  direction = 1,
  option = "gradient",
  guide = "colourbar",
  ...
)

scale_color_correlaid_c(
  direction = 1,
  option = "gradient",
  guide = "colourbar",
  ...
)

scale_fill_correlaid_c(
  direction = 1,
  option = "gradient",
  guide = "colourbar",
  ...
)

scale_colour_correlaid_b(
  direction = 1,
  option = "gradient",
  guide = "coloursteps",
  ...
)

scale_color_correlaid_b(
  direction = 1,
  option = "gradient",
  guide = "coloursteps",
  ...
)

scale_fill_correlaid_b(
  direction = 1,
  option = "gradient",
  guide = "coloursteps",
  ...
)

Arguments

direction

Sets the order of colours in the scale:

  • 1: default order

  • -1: reversed order

option

A character string indicating the colour palette to use. Four options are available:

  • "qualitative"

  • "gradient" and "gradient_x", based on the CorrelAid and CorrelAidX logo respectively

  • "grey"

...

Other arguments passed on to ggplot2::discrete_scale(), ggplot2::continuous_scale(), or ggplot2::binned_scale() to control name, limits, breaks, labels etc.

guide

A function used to create a guide or its name. See ggplot2::guides() for more information.

Details

Function naming scheme:

  • The suffix ⁠_d⁠ indicates that the scale is discrete.

  • ⁠_c⁠: continuous scale.

  • ⁠_b⁠: binned scale.

Change the following options() to set these scales as the default ggplot2 scales:

options(
  ggplot2.discrete.colour = correltools::scale_colour_correlaid_d,
  ggplot2.discrete.fill = correltools::scale_fill_correlaid_d,
  ggplot2.continuous.colour = correltools::scale_colour_correlaid_c,
  ggplot2.continuous.fill = correltools::scale_fill_correlaid_c
)

See Also

correlaid_pal()

Examples


library(ggplot2)

ggplot(example_projects_labels, aes(category, fill = category)) +
  geom_bar(show.legend = FALSE) +
  scale_fill_correlaid_d(option = "gradient")

ggplot(mtcars, aes(wt, mpg, colour = mpg)) +
  geom_point(size = 5) +
  scale_colour_correlaid_c()

ggplot(mtcars, aes(wt, mpg, fill = mpg)) +
  geom_point(shape = 21, colour = "white", size = 5) +
  scale_fill_correlaid_b()

CorrelAid/correltools documentation built on April 26, 2023, 8:19 a.m.