Skip to contents

Allows you to show colors from one of our palettes available in the g6tr.theme package. Built over scales::show_col(), but it also displays color name and its order in the palette. It also does not follow the show_col behavior where colors are plotted on a grid where row numbers are equal to col numbers. Instead the number of rows is adjusted by number of columns. E.g. specifying 8 colors in show_cols would results in a 4 x 4 grid. The first two rows would be colorful rectangles while the 2 bottom rows would be white. g6tr_show_colors on the other hand will produce a 2 x 4 grid of colorful rectangles.

Usage

g6tr_show_colors(
  brand = c("g6tr", "czi", "populace"),
  palette = c("core", "neutrals", "vary"),
  order = NULL,
  labels = TRUE,
  cex_label = 1,
  n_col = NULL
)

Arguments

brand

Character. One of: "g6tr", "czi", "populace".

palette

Character. One of: "core", "neutrals", "vary".

order

Numeric. Respective numbers of colors to be shown.

labels

Logical. If TRUE color hex value, name and order in palette will be shown on plot.

cex_label

Size of label to be shown.

n_col

Optional number of columns to arrange color grid.

Value

Plot with rectangles coloured with colors from chosen palette.

Examples

if (FALSE) { # \dontrun{
# Use order = NULL to show full palette
g6tr_show_colors(brand = "czi", palette = "core")
g6tr_show_colors(brand = "g6tr", palette = "vary")
g6tr_show_colors(brand = "populace", palette = "neutrals")

# Or pass a integer vector to order to show only a subsample of colors
g6tr_show_colors(brand = "czi", palette = "vary", order = c(1,5,2))
g6tr_show_colors(brand = "g6tr", palette = "neutrals", order = c(3:5, 6:7))
# You can also define number of columns to arrange colors grid differently
g6tr_show_colors(
  brand = "populace", palette = "core", order = c(9, 3:5), n_col = 3
)
} # }