Description Usage Arguments Details See Also Examples
View source: R/color_fun_unhcr.R View source: R/color_fun.R
seecol
provides an interface to plotting (or "seeing")
the colors of a palette or comparing multiple color palettes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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 |
seecol
has 2 main modes, based on the contents of its pal
argument:
if pal = "unikn_all"
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.
usecol
for using a color palette;
pal_unikn
for the default uni.kn color palette.
Other color functions:
newpal()
,
usecol()
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 41 42 43 44 | # See multiple color palettes:
seecol() # default: seecol(pal = "all")
# See details of one 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") # mixing hex values and color names
names(pal_mpg) <- c("mpg green", "mpg white", "mpg grey") # color names
pal_bdg <- usecol(c(Bordeaux, "gold"), n = 10) # using usecol
# Viewing extended color palette:
seecol(pal_mpg, n = 9, title = "Custom color palette of the Max Planck Society")
# Comparing (and labeling) custom color palettes:
seecol(list(pal_mpg, pal_bdg, pal_unikn), n = 7,
pal_names = c("Max Planck", "Bordeaux-Gold", "Uni Konstanz"),
title = "Comparing and labeling custom color palettes")
## 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.