Description Usage Arguments Author(s) Examples
Displays a horizontal or vertical color ramp.
1 | colramp(col = heat.colors(256), nr = 100, horizontal = TRUE, main, ...)
|
col |
A color palette. |
nr |
Number of steps in display. |
horizontal |
Orientation. Defaults to FALSE. |
main |
Passed to |
... |
Additional parameters for |
G. Sawitzki
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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.