Skip to contents

This function sets the color scale for ggplot2 using DOYPAColors color palettes, allowing you to apply these palettes to both discrete and continuous data.

Usage

scale_colour_doypa(
  palette = NULL,
  n = NULL,
  reverse = FALSE,
  gradient = FALSE,
  discrete = FALSE,
  type = "all",
  colorblind = FALSE,
  ...
)

Arguments

palette

A character string specifying the name of the palette to use. If `NULL`, a random palette will be selected.

n

Number of colors needed. If `NULL`, it will default to the number of levels for discrete scales or to a continuous gradient for continuous scales.

reverse

A logical value indicating whether to reverse the order of colors in the palette. Default is `FALSE`.

gradient

A logical value indicating whether to interpolate colors as a gradient of `n` colors between the first and last colors of the palette. If `FALSE`, returns the first `n` colors of the palette.

discrete

Boolean indicating whether to generate a discrete or continuous palette (default: continuous).

type

A character string specifying the type of palettes to select from: "all", "seq" (sequential), "div" (diverging), or "qual" (qualitative). Default is "all".

colorblind

A logical value indicating whether to restrict the palette to colorblind-friendly options. Default is `FALSE`.

...

Additional parameters passed to ggplot2's `scale_colour_*` functions.

Value

A `ggplot2` color scale suitable for adding to a `ggplot2` object to control color aesthetics.