seecol: Plot color palettes (to see their colors).

Description Usage Arguments Details See Also Examples

View source: R/color_fun.R

Description

seecol provides an interface to plotting (or "seeing") the colors of a palette or comparing multiple color palettes.

Usage

1
2
3
seecol(pal = "unikn_all", n = "all", alpha = NA, hex = NULL,
  rgb = NULL, col_bg = NULL, col_brd = NULL, lwd_brd = NULL,
  grid = TRUE, title = NA, ...)

Arguments

pal

A color palette (as a vector of colors), a character string recognized as keyword by seecol or multiple palettes specified as list. Default: pal = "unikn_all".

Recognized keywords are:

  1. "unikn_all": All color palettes defined in unikn

  2. "unikn_basic": All basic palettes.

  3. "pair_all": All palettes with pairwise colors.

  4. "pref_all": All preferred colors and their gradients.

  5. "grad_all":

seecol does also recognize reverse keywords (e.g., "all_unikn") or keywords without "unikn" (e.g., "basic").

n

Number of colors to show or use. If n is lower or higher than the length of the current color palette pal, the color palette is reduced or extrapolated (using grDevices::colorRampPalette). Default: n = "all" (i.e., show all colors in palette).

alpha

A factor modifying the opacity alpha (as in adjustcolor); typically in [0,1]. If used, the value is shown in the plot title. Default: alpha = NA (i.e., no modification of opacity).

hex

Should HEX color values be shown? Default: hex = NULL (i.e., show HEX color values when there is sufficient space to print them).

rgb

Should RGB color values be shown? Default: rgb = NULL (i.e., show RGB color values when there is sufficient space to print them).

col_bg

Color of plot background. Default: col_bg = NULL.

col_brd

Color of shape borders (if shown). Default: col_brd = NULL.

lwd_brd

Line width of shape borders (if shown). Default: lwd_brd = NULL.

grid

Show grid in the color plot? Default: grid = TRUE.

title

Plot title? Default: title = NA creates a default title.

...

Other graphical parameters (passed to plot).

Details

seecol has 2 main modes, based on the contents of its pal argument:

  1. if pal = "unikn_all" (or a list of multiple color palettes):

    Plot visual vectors of all current color palettes for comparing them.

  2. if pal is set to a specific color palette (or a vector of multiple colors or color palettes):

    Plot the current color palette and optional details on its colors.

See Also

usecol to use a color palette; pal_unikn for the default uni.kn color palette.

Other color functions: newpal, usecol

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# See all color palettes: 
seecol()  # same as seecol(pal = "all") 

# See details of a color palette: 
seecol(pal_unikn)  # see a specific color palette

# Combining colors or color palettes: 
seecol(c(rev(pal_seeblau), pal_seegruen))        # combine color palettes
seecol(c(rev(pal_seeblau), "white", pal_pinky))  # combine color palettes and color names
seecol(c("black", "firebrick", "gold"))          # combine color names

# Using n to reduce or extend color palettes:
seecol(n =  3)  # viewing reduced ranges of all palettes
seecol(n = 12)  # viewing extended ranges of all palettes

seecol(pal_unikn, n = 5, 
       title = "Reduced version of pal_unikn (n = 5)")  # reducing pal_unikn
seecol(pal_seeblau, n = 8, 
       title = "Extended version of pal_seeblau (n = 8)")  # extending pal_seeblau

# Combining and extending color palettes: 
seecol(c(rev(pal_seeblau), "white", pal_bordeaux), n = 17, 
       title = "Diverging custom color palette with 17 colors")

# Defining custom color palettes:
pal_mpg <- c("#007367", "white", "#D0D3D4")
names(pal_mpg) <- c("mpg green", "mpg white", "mpg grey")

# Viewing extended color palette: 
seecol(pal_mpg, n = 9, title = "Custom color palette for Max Planck Society")

# Comparing color palettes: 
seecol(list(pal_mpg, pal_bordeaux, pal_unikn), n = 5)

## Viewing color palettes from other packages: 
# library(RColorBrewer)
# seecol(brewer.pal(name = "RdBu", n = 11))  # viewing "RdBu" palette from RColorBrewer

## Extending color palettes:
# seecol(brewer.pal(name = "RdBu", n = 11), n = 15)  # extending palette to 15 colors

unikn documentation built on Sept. 25, 2019, 5:02 p.m.