ac | R Documentation |
ac
adjusts the transparency of a color or color palette col
to an opacity level alpha
(in [0, 1]
).
ac(col, alpha = 0.5, use_names = TRUE)
col |
A (required) color or color palette (as a vector). |
alpha |
A factor modifying the opacity alpha
(as |
use_names |
A logical value indicating whether color names should be adjusted
to include the values of |
ac
is mostly a wrapper for adjustcolor
of the grDevices package, but allows for more flexible
combinations of (multiple) col
and alpha
values.
The name ac
is an abbreviation of "adjust color",
but is also a mnemonic aid for providing "air conditioning".
A color vector of the same length as col
,
transformed by adjustcolor
.
seecol
for plotting/seeing color palettes;
usecol
for using color palettes;
simcol
for finding similar colors;
newpal
for defining new color palettes;
grepal
for finding named colors.
Other color functions:
demopal()
,
grepal()
,
newpal()
,
seecol()
,
shades_of()
,
simcol()
,
usecol()
ac("black") # using alpha = .5 by default
# multiple colors:
cols <- ac(c("black", "gold", "deepskyblue"), alpha = .50)
seecol(cols, main = "Transparent colors")
# multiple alphas:
blacks <- ac("black", alpha = 5:0/5)
seecol(blacks, main = "One col several alpha values")
bgc <- ac(c("black", "gold"), alpha = 1:6/6)
seecol(bgc, main = "More alpha values than cols")
# Using a color palette:
seecol(ac(pal_unikn_pref, 2/3), main = "Adding color transparency by ac()")
# Color names:
seecol(ac(col = pal_unikn_pref, alpha = c(1/5, 4/5), use_names = TRUE))
seecol(ac(col = pal_unikn_pref, alpha = c(1/5, 4/5), use_names = FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.