Sequential color palette

Share:

Description

Sequential color palette from yelow to red or yellow to blue or custom colors.

Usage

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

Arguments

n

Number of colors. DEFAULT: 12

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

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, addAlpha, colorRampPalette, package RColorBrewer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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.09))

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)) 
 

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.