seqPal: Sequential color palette

View source: R/pal.R

seqPalR Documentation

Sequential color palette

Description

Sequential color palette from yellow to blue or custom colors.

Usage

seqPal(
  n = 100,
  reverse = FALSE,
  alpha = 1,
  extr = FALSE,
  yb = FALSE,
  yr = FALSE,
  gb = FALSE,
  b = FALSE,
  colors = NULL,
  logbase = 1,
  ...
)

Arguments

n

Number of colors. DEFAULT: 100

reverse

Reverse colors? DEFAULT: FALSE

alpha

Transparency (0=transparent, 1=fully colored). DEFAULT: 1

extr

Should colors span possible range more extremely? If TRUE, it has very light yellow and very dark blue values included, using the result from RColorBrewer::brewer.pal(9, "YlGnBu"). DEFAULT: FALSE

yb

Should colors be in yellow-blue instead of the internal (nice) default? DEFAULT: FALSE

yr

Should colors be in yellow-red instead of the default? DEFAULT: FALSE

gb

Should colors be in green-blue instead of the default? DEFAULT: FALSE

b

Should colors be in an increasingly saturated blue? DEFAULT: FALSE

colors

If not NULL, a color vector used in colorRampPalette. DEFAULT: NULL

logbase

If !=1, this is passed to classify and logSpaced. DEFAULT: 1

...

Further arguments passed to colorRamp

Value

Character string vector with color names

Author(s)

Berry Boessenkool, berry-b@gmx.de, Jan 2016

See Also

showPal, divPal, catPal, addAlpha, colorRampPalette, package RColorBrewer

Examples

plot(rep(1,12),  pch=16, cex=5, col=seqPal(12), xaxt="n")
showPal()

# nonlinear color scale (use colPoints + see classify for more options):
v <- rescale(volcano^30)
image(v, col=seqPal(1000), asp=1);  colPointsLegend(v, nbins=1000)
image(v, col=seqPal(1000, logbase=1.007), asp=1)
colPointsLegend(v, col=seqPal(1000, logbase=1.007))

plot(    rep(1, 1000), pch=15, cex=3, col=seqPal(1000), ylim=c(0.99, 1.01), ylab="logbase", las=1)
for(b in seq(0.99, 1.01, len=30))
    points(rep(b, 1000), pch=15, cex=1, col=seqPal(1000, logbase=b))


berryFunctions documentation built on May 29, 2024, 4:01 a.m.