This function is very simillar to the show_cols() in 'scales'. The main difference is that this function returns a true ggplot2 object. This allows for further customization.

show_palette(cols, num_rows = "square", label_size = 5,
  font_family = "Times", base_size = label_size, ...)

Arguments

cols

The colors to present in a matrix. If the values are named, these will be used for the cell label. If not, then the color value itself is used for the label.

num_rows

The number of rows to use or if the matrix should be as square as possible.

label_size

The size passed to ggplot2::geom_text() for the size of the label. Default is 5.

font_family

The font to use for thee plot. Default is "Times".

base_size

The base font size passed to theme_bw(). The default is to use label_size.

...

Any other information to pass to ggplot2::theme().

Value

A ggplot2 object.

Examples

pal <- c("#3fc5f0", "#42dee1", "#6decb9", "#eef5b2") show_palette(pal)
show_palette(pal, num_rows = 1)
names(pal) <- paste("color", 1:4) show_palette(pal)