Package 'PrettyCols'

Title: Pretty Colour Palettes
Description: Defines aesthetically pleasing colour palettes.
Authors: Nicola Rennie [aut, cre]
Maintainer: Nicola Rennie <[email protected]>
License: CC0
Version: 1.1.0.9002
Built: 2025-01-03 06:45:31 UTC
Source: https://github.com/nrennie/prettycols

Help Index


Returns a data frame of colorblind friendly colour palettes

Description

Returns a data frame of colorblind friendly colour palettes

Usage

colorblind_friendly(palettes = PrettyColsPalettes)

Arguments

palettes

List of palettes. Default PrettyColsPalettes.

Value

A data frame with two columns giving names and types of colourblind friendly palettes.

Examples

colorblind_friendly()

Returns a data frame of colourblind friendly colour palettes

Description

Returns a data frame of colourblind friendly colour palettes

Usage

colourblind_friendly(palettes = PrettyColsPalettes)

Arguments

palettes

List of palettes. Default PrettyColsPalettes.

Value

A data frame with two columns giving names and types of colourblind friendly palettes.

Examples

colourblind_friendly()

Generates the colour palettes

Description

Generates the colour palettes

Usage

prettycols(palette, n, type = "discrete", direction = 1)

Arguments

palette

Name of Palette. Run names(PrettyColsPalettes) to view options.

n

Number of desired colors. If number of requested colors is beyond the scope of the palette, colors are automatically interpolated. If n is not provided, the length of the palette is used.

type

Either "continuous" or "discrete". Use continuous if you want to automatically interpolate between colors. Default "discrete"

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

Value

A character vector of hex colour codes.

Examples

prettycols("Blues")

Complete list of palettes.

Description

Use names(PrettyColsPalettes) to return all palette names.

Usage

PrettyColsPalettes

Format

An object of class list of length 46.


Plotting with PrettyCols palettes for colour ggplot2

Description

Plotting with PrettyCols palettes for colour ggplot2

Usage

scale_color_pretty_c(palette, direction = 1, legend_title = NULL, ...)

Arguments

palette

Name of Palette. Run names(PrettyColsPalettes) to view options.

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

legend_title

[Deprecated] Deprecated in favour of name.

...

Other arguments passed on to scale_color_gradientn

Value

A ggproto object defining a continuous colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, color = wt)) +
  geom_point() +
  scale_color_pretty_c("Greens")

Plotting with PrettyCols palettes for colour ggplot2

Description

Plotting with PrettyCols palettes for colour ggplot2

Usage

scale_color_pretty_d(palette, direction = 1, legend_title = NULL, ...)

Arguments

palette

Name of Palette. Run names(PrettyColsPalettes) to view options.

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

legend_title

[Deprecated] Deprecated in favour of name.

...

Other arguments passed on to discrete_scale

Value

A ggproto object defining a discrete colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, color = factor(cyl))) +
  geom_point() +
  scale_color_pretty_d("Bright")

Plotting with PrettyCols palettes for colour ggplot2

Description

Plotting with PrettyCols palettes for colour ggplot2

Usage

scale_color_pretty_div(palette, direction = 1, legend_title = NULL, ...)

Arguments

palette

Name of Palette. Run view_all_palettes(type = "div") to view options. Must be a diverging palette name.

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

legend_title

[Deprecated] Deprecated in favour of name.

...

Other arguments passed on to scale_colour_gradient2

Value

A ggproto object defining a continuous colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, colour = wt)) +
  geom_point() +
  scale_color_pretty_div("PurpleYellows", midpoint = mean(mtcars$wt))

Plotting with PrettyCols palettes for colour ggplot2

Description

Plotting with PrettyCols palettes for colour ggplot2

Usage

scale_colour_pretty_c(palette, direction = 1, legend_title = NULL, ...)

Arguments

palette

Name of Palette. Run names(PrettyColsPalettes) to view options.

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

legend_title

[Deprecated] Deprecated in favour of name.

...

Other arguments passed on to scale_colour_gradientn

Value

A ggproto object defining a continuous colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, colour = wt)) +
  geom_point() +
  scale_colour_pretty_c("Greens")

Plotting with PrettyCols palettes for colour ggplot2

Description

Plotting with PrettyCols palettes for colour ggplot2

Usage

scale_colour_pretty_d(palette, direction = 1, legend_title = NULL, ...)

Arguments

palette

Name of Palette. Run names(PrettyColsPalettes) to view options.

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

legend_title

[Deprecated] Deprecated in favour of name.

...

Other arguments passed on to discrete_scale

Value

A ggproto object defining a discrete colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, colour = factor(cyl))) +
  geom_point() +
  scale_colour_pretty_d("Bright")

Plotting with PrettyCols palettes for colour ggplot2

Description

Plotting with PrettyCols palettes for colour ggplot2

Usage

scale_colour_pretty_div(palette, direction = 1, legend_title = NULL, ...)

Arguments

palette

Name of Palette. Run view_all_palettes(type = "div") to view options. Must be a diverging palette name.

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

legend_title

[Deprecated] Deprecated in favour of name.

...

Other arguments passed on to scale_colour_gradient2

Value

A ggproto object defining a continuous colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, colour = wt)) +
  geom_point() +
  scale_colour_pretty_div("PurpleYellows", midpoint = mean(mtcars$wt))

Plotting with PrettyCols palettes for colour ggplot2

Description

Plotting with PrettyCols palettes for colour ggplot2

Usage

scale_fill_pretty_c(palette, direction = 1, legend_title = NULL, ...)

Arguments

palette

Name of Palette. Run names(PrettyColsPalettes) to view options.

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

legend_title

[Deprecated] Deprecated in favour of name.

...

Other arguments passed on to scale_fill_gradientn

Value

A ggproto object defining a continuous fill scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, fill = wt)) +
  geom_point(pch = 21) +
  scale_fill_pretty_c("Greens")

Plotting with PrettyCols palettes for colour ggplot2

Description

Plotting with PrettyCols palettes for colour ggplot2

Usage

scale_fill_pretty_d(palette, direction = 1, legend_title = NULL, ...)

Arguments

palette

Name of Palette. Run names(PrettyColsPalettes) to view options.

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

legend_title

[Deprecated] Deprecated in favour of name.

...

Other arguments passed on to discrete_scale

Value

A ggproto object defining a discrete fill scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, fill = factor(cyl))) +
  geom_point(pch = 21) +
  scale_fill_pretty_d("Bright")

Plotting with PrettyCols palettes for fill colour ggplot2

Description

Plotting with PrettyCols palettes for fill colour ggplot2

Usage

scale_fill_pretty_div(palette, direction = 1, legend_title = NULL, ...)

Arguments

palette

Name of Palette. Run view_all_palettes(type = "div") to view options. Must be a diverging palette name.

direction

Sets order of colors. Default palette is 1. If direction is -1, palette color order is reversed

legend_title

[Deprecated] Deprecated in favour of name.

...

Other arguments passed on to scale_colour_gradient2

Value

A ggproto object defining a continuous colour scale for use with ggplot2.

Examples

library(ggplot2)
ggplot(data = mtcars, aes(x = mpg, y = disp, fill = wt)) +
  geom_point(pch = 21) +
  scale_fill_pretty_div("PurpleYellows", midpoint = mean(mtcars$wt))

Prints all available colour palettes

Description

Prints all available colour palettes

Usage

view_all_palettes(type = "all", colourblind_friendly = FALSE)

Arguments

type

Type of colour palettes to view. Either all palettes, sequential palettes, diverging palettes, or qualitative palettes. Types must be at least one of c("all", "seq", "div", "qual"). Default "all".

colourblind_friendly

Boolean whether or not to return only colourblind friendly palettes. Default FALSE.

Value

A plot of all colour palettes available in the package.

Examples

view_all_palettes(type = "seq")
view_all_palettes(type = c("seq", "div"))
view_all_palettes(type = "div", colourblind_friendly = TRUE)