colramp: Displays a horizontal or vertical color ramp.

Description Usage Arguments Author(s) Examples

View source: R/colramp.R

Description

Displays a horizontal or vertical color ramp.

Usage

1
colramp(col = heat.colors(256), nr = 100, horizontal = TRUE, main, ...)

Arguments

col

A color palette.

nr

Number of steps in display.

horizontal

Orientation. Defaults to FALSE.

main

Passed to plot

...

Additional parameters for plot.

Author(s)

G. Sawitzki

Examples

 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
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (col=  heat.colors(256),  nr=256, horizontal=FALSE, main,...)
{
#! add support for functions passed as col
#! add support for translated scale, e.g. log
if (is.function(col) )
{
#cat(deparse(col),nr)
stop("function support not yet implemented")
#eval(call(col,nr))
  }
if (missing(main)) main<-deparse(substitute(col))
if (missing(nr)) nr<-length(col)
if (horizontal)
	{
	a <- matrix(nrow= nr, ncol= 1)
	a[,1]<-c(1:nr)
	oldpar <- par(yaxt="n")
	image(,,a,col=col,main=main,...)
	} else
	{
	a <- matrix(ncol= nr, nrow= 1)
	a[1,]<-c(1:nr)
	oldpar <- par(xaxt="n")
	image(,,a,col=col,main=main,...)
	}
	par(oldpar)
  }

bertin documentation built on May 31, 2017, 4:16 a.m.