Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

show_col

Show colours


Description

A quick and dirty way to show colours in a plot.

Usage

show_col(colours, labels = TRUE, borders = NULL, cex_label = 1, ncol = NULL)

Arguments

colours

A character vector of colours

labels

Label each colour with its hex name?

borders

Border colour for each tile. Default uses par("fg"). Use border = NA to omit borders.

cex_label

Size of printed labels, as multiplier of default size.

ncol

Number of columns. If not supplied, tries to be as square as possible.

Examples

show_col(hue_pal()(9))
show_col(hue_pal()(9), borders = NA)

show_col(viridis_pal()(16))
show_col(viridis_pal()(16), labels = FALSE)

scales

Scale Functions for Visualization

v1.1.1
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], Dana Seidel [aut], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.