seecol
provides an interface to plotting (or "seeing")
the colors of a palette or comparing multiple color palettes.
seecol
has 2 main modes, based on the contents of its pal
argument:
if pal = "unhcr_all_pal"
or a list of multiple color palettes:
Plot visual vectors of all current color palettes for comparing them.
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.
The title
and pal_names
arguments add control over plotted text labels.
However, the length of a character vector provided to pal_names
must correspond
to the number of (custom) color palettes or colors.
seecol( pal = "unhcr_pal_all", n = "all", alpha = NA, hex = NULL, rgb = NULL, col_bg = NULL, col_brd = NULL, lwd_brd = NULL, grid = TRUE, title = NA, pal_names = NA, ... )
pal | A single color palette (as a vector of colors),
multiple color palettes (as a list),
or a recognized keyword (as a character string).
Default: Recognized keywords are:
|
---|---|
n | Number of colors to show or use.
If |
alpha | A factor modifying the opacity alpha (as in |
hex | Should HEX color values be shown?
Default: |
rgb | Should RGB color values be shown?
Default: |
col_bg | Color of plot background.
Default: |
col_brd | Color of shape borders (if shown).
Default: |
lwd_brd | Line width of shape borders (if shown).
Default: |
grid | Show grid in the color plot?
Default: |
title | Plot title (as a character string).
Default: |
pal_names | Names of color palettes or colors
(as a character vector).
Default: |
... | Other graphical parameters
(passed to |
usecol
for using a color palette;
unhcr_pal_all
for the default unhcr color palette
{ # See multiple color palettes: seecol() # default: seecol(pal = "all") # See details of one color palette: seecol(unhcr_pal) # see a specific color palette # Combining colors or color palettes: seecol(c(rev(unhcr_pal_blue), unhcr_pal_green)) # combine color palettes 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(unhcr_pal, n = 5, title = "Reduced version of unhcr_pal (n = 5)") # reducing unhcr_pal seecol(unhcr_pal_green, n = 8, title = "Extended version of unhcr_pal_green (n = 8)") # extending unhcr_pal_green # Combining and extending color palettes: seecol(c(rev(unhcr_pal_blue), "white", unhcr_pal_red), n = 17, title = "Diverging custom color palette (with 17 colors)") # Defining custom color palettes: pal_mpg <- c("#007367", "white", "#D0D3D4") # mixing hex values and color names # Viewing extended color palette: seecol(pal_mpg, n = 9, title = "Custom color palette") ## Viewing color palettes from other packages: library(RColorBrewer) # viewing "RdBu" palette from RColorBrewer seecol(brewer.pal(name = "RdBu", n = 11)) ## Extending color palettes # extending palette to 15 colors seecol(brewer.pal(name = "RdBu", n = 11), n = 15) }#> Error in parse_pal(pal = pal): Input "unhcr_all" does not exist