show_colours: Preview a list of colours as a grid

View source: R/plot_tools.R

show_coloursR Documentation

Preview a list of colours as a grid

Description

Preview a list of colours as a grid

Usage

show_colours(
  col_list,
  arrange = "rect",
  n = NULL,
  pad = "#FFFFFF",
  asp = NA,
  main = NULL
)

show_colors(
  col_list,
  arrange = "rect",
  n = NULL,
  pad = "#FFFFFF",
  asp = NA,
  main = NULL
)

Arguments

col_list

(Character) A vector of colours in RGB Hex or RGBA Hex format.

arrange

(Character: "rect", "rows", or "cols") By default ("rect"), colours are displayed in a rectangular panel. "rows" arranges them as horizontal stripes top-to-bottom, and "cols" arranges them as vertical stripes left-to-right.

n

(Integer) If not NULL (default), then controls how tall (in cells) the resulting grid will be. You would typically do this if you were trying to show a palette that you have already manually padded to specific dimensions, e.g. for a palette that has 14 tints/shades for each hue, use n = 14 to arrange all hues into columns of 14 cells.

pad

(Character) If there are too few colours to fill all of the spaces in the grid, what colour should be used to pad it out? pad = "last" repeats the last colour in the colour list. A hex colour can be provided too. Otherwise, this defaults to white ('#FFFFFF“).

asp

(Numeric or NA) The aspect ratio of the image. Tweak this if you want to produce a graphic with square cells. If NA, plot.window's default will be used.

main

(Character or NULL) Leave this as NULL to generate a title. Supply a string to define your own title.

Value

A graphic that shows all of the colours in col_list.

Examples

show_colours(colours(distinct = TRUE))

show_colours(colours(distinct = TRUE), arrange = "cols")


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.